Skip to content

Commit 196d4b1

Browse files
committed
Style.h: Renaming shade_style16() back to shade_style() again, because now it supports all 256 colors.
* Perhaps doesn't shade styles perfectly, but it is a good start.
1 parent 9ec1a82 commit 196d4b1

2 files changed

Lines changed: 7 additions & 15 deletions

File tree

include/Termin8or/drawing/Drawing.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ namespace t8x
227227

228228
auto f_shade_style = [&](const Style& style, int r0, int c0)
229229
{
230-
return shade_style16(style, f_has_light(r0, c0) ?
230+
return shade_style(style, f_has_light(r0, c0) ?
231231
ShadeType::Bright : ShadeType::Unchanged, true);
232232
};
233233

@@ -280,7 +280,7 @@ namespace t8x
280280

281281
auto f_shade_style = [&](const Style& style, int r0, int c0)
282282
{
283-
return shade_style16(style, f_has_light(r0, c0) ?
283+
return shade_style(style, f_has_light(r0, c0) ?
284284
ShadeType::Bright : ShadeType::Unchanged, true);
285285
};
286286

include/Termin8or/screen/Styles.h

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ namespace t8
8888
return ret;
8989
}
9090

91-
Style shade_style16(const Style& style, ShadeType shade, bool only_swap_if_fg_bg_same = false)
91+
Style shade_style(const Style& style, ShadeType shade, bool only_swap_if_fg_bg_same = false, int rgb6_step = 1, int gray24_step = 3)
9292
{
9393
Style ret = style;
9494
switch (shade)
@@ -98,22 +98,14 @@ namespace t8
9898
break;
9999
case ShadeType::Bright:
100100
{
101-
auto fg_color16 = style.fg_color.try_get_color16();
102-
auto bg_color16 = style.bg_color.try_get_color16();
103-
if (fg_color16.has_value())
104-
ret.fg_color = shade_color16(fg_color16.value(), ShadeType::Dark);
105-
if (bg_color16.has_value())
106-
ret.bg_color = shade_color16(bg_color16.value(), ShadeType::Bright);
101+
ret.fg_color = shade_color(style.fg_color, ShadeType::Dark, rgb6_step, gray24_step);
102+
ret.bg_color = shade_color(style.bg_color, ShadeType::Bright, rgb6_step, gray24_step);
107103
break;
108104
}
109105
case ShadeType::Dark:
110106
{
111-
auto fg_color16 = style.fg_color.try_get_color16();
112-
auto bg_color16 = style.bg_color.try_get_color16();
113-
if (fg_color16.has_value())
114-
ret.fg_color = shade_color16(fg_color16.value(), ShadeType::Bright);
115-
if (bg_color16.has_value())
116-
ret.bg_color = shade_color16(bg_color16.value(), ShadeType::Dark);
107+
ret.fg_color = shade_color(style.fg_color, ShadeType::Bright, rgb6_step, gray24_step);
108+
ret.bg_color = shade_color(style.bg_color, ShadeType::Dark, rgb6_step, gray24_step);
117109
break;
118110
}
119111
}

0 commit comments

Comments
 (0)