Documentation

TermColor.Color

TermColor.Color: colors and terminal color levels #

Color describes a color independently of a terminal. Rendering chooses the strongest representation the target terminal can accept: the eight ANSI colors, the xterm 256-color palette, or 24-bit RGB. default means the terminal's configured default color.

The RGB-to-palette conversions use the conventional xterm palette. A terminal may let its user redefine that palette, so RGB fallback is necessarily an approximation unless the caller chooses a stronger target.

The eight ANSI color names.

Instances For
    @[instance_reducible]
    Equations
    Equations
    Instances For

      The two intensities of the eight ANSI colors.

      Instances For
        @[instance_reducible]
        Equations

        A color that can be represented by ANSI SGR color parameters.

        Instances For
          def TermColor.instDecidableEqColor.decEq (x✝ x✝¹ : Color) :
          Decidable (x✝ = x✝¹)
          Equations
          Instances For
            Equations
            Instances For
              def TermColor.Color.hue (degrees : Nat) :

              The fully saturated, full-brightness color at a hue given in degrees.

              The hue wheel wraps, so any Nat is a valid argument. Saturation and value are fixed at their maximum, which is what gradients and rainbows want; for anything else build .rgb directly.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                The xterm 256-color index nearest to an RGB color.

                The 6×6×6 cube is used for chromatic colors and the 8..238 grayscale ramp for exact grays; pure black and white use the exact ANSI-16 endpoints.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  The conventional RGB value represented by an xterm 256-color index.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    The ANSI-16 index nearest to an RGB color, using the conventional xterm palette.

                    Equations
                    Instances For

                      The xterm 256-color index represented by a color when a palette fallback is needed.

                      Equations
                      Instances For

                        The ANSI-16 index represented by a color when only the basic palette is available.

                        Equations
                        Instances For

                          Terminal color levels #

                          The color precision a terminal can receive through SGR.

                          Instances For
                            @[instance_reducible]
                            Equations
                            Equations
                            Instances For