# LLM Prompt for Documentation ## Documentation ### Color #### Color **Type Annotation** **Description** Type that represents a color code for formatting. Use `ansi`, `color256bit` or `rgb` to construct it. #### DisplayAttribute **Type Annotation** ```roc [ Reset, Bold, Dim, Italic, Underscore, Blink, Reverse, Hidden ] ``` **Description** Display attributes for SGR. When using `formatWith` you should use the lowercase variants exported by this module (see the documentation for `formatWith`). Please note that `Italic` is not officially specified for SGR but many terminals support it. `Bold` is sometimes interpreted as "bright". Most terminals however format the text as bold. #### AnsiColor **Type Annotation** ```roc [ Black, Blue, Cyan, Green, Magenta, Red, White, Yellow ] ``` **Description** SGR colors. These colors are most likely to work with most terminals. Use `ansi` to turn them into a `Color` or use the already exported constants provided by this module. #### formatWith **Type Annotation** ```roc List [ Display DisplayAttribute, Foreground Color, Background Color ], Str -> Str ``` **Description** Wraps the string argument with a SGR that reflects the attributes and colors in the input list and a reset for SGR after it. When printing the resulting string to the terminal, it will be styled acoordingly assuming the terminal supports the chosen display attributes and colors. ## Usage You are meant to import this function and your desired attributes by `exposing` them, so the syntax is less cluttered. ``` import color.Color exposing [formatWith, bold, italic, underscore, rgb, blue, whiteBg, foreground] main = line1 = formatWith [bold, blue, whiteBg] "foobar" Stdout.line! "My first text: $(line1)" line2 = formatWith [italic, underscore, foreground (rgb 25 233 143)] "barfoo" Stdout.line! "My second text: $(line2)" ``` Assuming that at most a single `Foreground` and `Background` color is present in the list, the order of elements is not relevant. If multiple `Foreground` and/or `Background` values are present, it's undefined which and if colors will be chosen. #### selectGraphicRendition **Type Annotation** **Description** Generate a single SGR with the attributes given in a record of optional values. The type of this function is: ``` selectGraphicRendition : { attrs ? List DisplayAttribute, bgColor ? Color, fgColor ? Color } -> Str ``` #### resetGraphicRendition **Type Annotation** ```roc Str ``` **Description** String to reset the SGR. This is equivalent to `selectGraphicRendition {attrs: [Reset]}`. #### ansi **Type Annotation** ```roc AnsiColor -> Color ``` **Description** Turns an `AnsiColor` into a `Color`. It's most likely that your targeted terminals support this color type. #### color256bit **Type Annotation** ```roc U8 -> Color ``` **Description** Turns a byte into a 256 bit color. Please note that this color type might not be supported by your targeted terminals. If you don't need fine-grained control of colors you should stick with `AnsiColor` values. #### rgb **Type Annotation** ```roc U8, U8, U8 -> Color ``` **Description** Turns three bytes into a Truecolor RGB color. Please note that this color type might not be supported by your targeted terminals. If you don't need fine-grained control of colors you should stick with `AnsiColor` values. #### rgbHex **Type Annotation** ```roc Str -> Color ``` **Description** Interprets a [hexadecimal color](https://en.wikipedia.org/wiki/Web_colors) as a Truecolor RGB color. If the supplied string fails to parse, the color will not influence formatting. ## Format `#rrggbb` or `#rgb` The string must contain 3 bytes in hexadecimal format (00-FF). Alternatively, the string can only consist of three characters (0-F) that describe the individual bytes to be made up of the specified character twice, meaning that `F` turns into `FF` and `5` turns into `55`. Letters can be uppercase or lowercase. The string can be prefixed with an optional `#`. ## Examples `"#000"` results in black color. `"#1E90FF"` is an RGB value of (30, 144, 255). #### foreground **Type Annotation** ```roc Color -> [Foreground Color] ``` **Description** Marks a `Color` to be used for the foreground (the text color). #### background **Type Annotation** ```roc Color -> [Background Color] ``` **Description** Marks a `Color` to be used for the background. #### black **Type Annotation** #### blue **Type Annotation** #### cyan **Type Annotation** #### green **Type Annotation** #### magenta **Type Annotation** #### red **Type Annotation** #### white **Type Annotation** #### yellow **Type Annotation** #### blackBg **Type Annotation** #### blueBg **Type Annotation** #### cyanBg **Type Annotation** #### greenBg **Type Annotation** #### magentaBg **Type Annotation** #### redBg **Type Annotation** #### whiteBg **Type Annotation** #### yellowBg **Type Annotation** #### blink **Type Annotation** #### bold **Type Annotation** #### italic **Type Annotation** #### dim **Type Annotation** #### hidden **Type Annotation** #### reset **Type Annotation** #### reverse **Type Annotation** #### underscore **Type Annotation**