Add ui::style::scale

This commit is contained in:
Nikita Lisitsa 2022-02-15 11:23:14 +03:00
parent 36446c66ac
commit 615fc029e7
2 changed files with 7 additions and 0 deletions

View file

@ -16,6 +16,8 @@ namespace psemek::ui
struct style
{
std::optional<int> scale;
std::optional<gfx::color_rgba> bg_color;
std::optional<gfx::color_rgba> fg_color;
std::optional<gfx::color_rgba> highlight_color;

View file

@ -36,6 +36,7 @@ namespace psemek::ui
void merge(style & dst, style const & src)
{
merge(dst.scale, src.scale);
merge(dst.bg_color, src.bg_color);
merge(dst.fg_color, src.fg_color);
merge(dst.highlight_color, src.highlight_color);
@ -62,6 +63,7 @@ namespace psemek::ui
style scale(style const & s, float factor)
{
style result = s;
scale(result.scale, factor);
scale(result.action_offset, factor);
scale(result.border_width, factor);
scale(result.ref_height, factor);
@ -76,6 +78,9 @@ namespace psemek::ui
style default_style()
{
style s;
s.scale = 1;
s.bg_color = {95, 95, 95, 255};
s.fg_color = {127, 127, 127, 255};
s.highlight_color = {159, 159, 159, 255};