Skip to content

Add color themes properties #4

@TristanCacqueray

Description

@TristanCacqueray

The goal of this issue is to enable the user to provide their own CSS values for the ones hard-coded here:

re-ansi/src/Ansi.re

Lines 37 to 56 in 6e07d47

// Convert a 4 bits color code to its css color: https://en.wikipedia.org/wiki/ANSI_escape_code#3-bit_and_4-bit
let fourBitColors = (code: int): option(string) =>
switch (code) {
| 00 => "black"->Some
| 01 => "red"->Some
| 02 => "green"->Some
| 03 => "yellow"->Some
| 04 => "blue"->Some
| 05 => "magenta"->Some
| 06 => "cyan"->Some
| 07 => "white"->Some
| 09 => "initial"->Some
| 10 => "grey"->Some
| 11 => "#DA2647"->Some
| 12 => "#87FF2A"->Some
| 13 => "#FFF700"->Some
| 14 => "#5DADEC"->Some
| 15 => "#FF3399"->Some
| 16 => "#8DD9CC"->Some
| 17 => "white"->Some
.

In particular, we need to enable the user to provide their own initial value for the code 9, as documented in #3

To do that, we could:

  • add an optional fourBitColors function property to the React component, or
  • define a color palete type property, and modify the existing fourBitColors function to use that instead.

When color themes is implemented, it might be good to also provide default themes, such as dark, light, and their solarized version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions