diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-08-21 16:47:48 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-08-21 16:47:48 +0000 |
| commit | 631e0c0870d98a4b3f97c90a8f3d07d549fdf8fb (patch) | |
| tree | 9de02fa30d0ff9fe42e794ea4a036cc472726601 /csi.c | |
| parent | osc: fix indexing into 'bright' color array (diff) | |
term: use colors256 array for *all* colors
That is, remove the 'regular' and 'bright' color arrays. This is
possible since the 256-color array is defined such that the first 16
colors map to the regular and bright colors.
Diffstat (limited to 'csi.c')
| -rw-r--r-- | csi.c | 29 |
1 files changed, 7 insertions, 22 deletions
@@ -105,7 +105,7 @@ csi_sgr(struct terminal *term) case 36: case 37: term->vt.attrs.have_fg = 1; - term->vt.attrs.fg = term->colors.regular[param - 30]; + term->vt.attrs.fg = term->colors.colors256[param - 30]; break; case 38: { @@ -113,15 +113,8 @@ csi_sgr(struct terminal *term) term->vt.params.v[i + 1].value == 5) { uint8_t idx = term->vt.params.v[i + 2].value; - uint32_t color; - if (idx < 8) - color = term->colors.regular[idx]; - else if (idx < 16) - color = term->colors.bright[idx - 8]; - else - color = term->colors.colors256[idx]; term->vt.attrs.have_fg = 1; - term->vt.attrs.fg = color; + term->vt.attrs.fg = term->colors.colors256[idx]; i += 2; } @@ -175,7 +168,7 @@ csi_sgr(struct terminal *term) case 46: case 47: term->vt.attrs.have_bg = 1; - term->vt.attrs.bg = term->colors.regular[param - 40]; + term->vt.attrs.bg = term->colors.colors256[param - 40]; break; case 48: { @@ -183,16 +176,8 @@ csi_sgr(struct terminal *term) term->vt.params.v[i + 1].value == 5) { uint8_t idx = term->vt.params.v[i + 2].value; - uint32_t color; - - if (idx < 8) - color = term->colors.regular[idx]; - else if (idx < 16) - color = term->colors.bright[idx - 8]; - else - color = term->colors.colors256[idx]; term->vt.attrs.have_bg = 1; - term->vt.attrs.bg = color; + term->vt.attrs.bg = term->colors.colors256[idx]; i += 2; } @@ -245,10 +230,10 @@ csi_sgr(struct terminal *term) case 96: case 97: term->vt.attrs.have_fg = 1; - term->vt.attrs.fg = term->colors.bright[param - 90]; + term->vt.attrs.fg = term->colors.colors256[param - 90 + 8]; break; - /* Regular background colors */ + /* Bright background colors */ case 100: case 101: case 102: @@ -258,7 +243,7 @@ csi_sgr(struct terminal *term) case 106: case 107: term->vt.attrs.have_bg = 1; - term->vt.attrs.bg = term->colors.bright[param - 100]; + term->vt.attrs.bg = term->colors.colors256[param - 100 + 8]; break; default: |
