Skip to content

Commit

Permalink
feat: allow customisation of the overlay base color
Browse files Browse the repository at this point in the history
  • Loading branch information
tristan-hm committed Sep 12, 2022
1 parent c9fd77f commit b6fb7df
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
8 changes: 8 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ class NDPreferences(AddonPreferences):
size=3,
)

overlay_base_color: FloatVectorProperty(
name="Overlay Base Color",
default=(255/255, 255/255, 255/255),
subtype='COLOR_GAMMA',
size=3,
)

overlay_option_active_color: FloatVectorProperty(
name="Overlay Option Active Color",
default=(55/255, 174/255, 255/255),
Expand Down Expand Up @@ -556,6 +563,7 @@ def draw_theme(self, box):
"overlay_header_standard_color",
"overlay_header_recalled_color",
"overlay_header_paused_color",
"overlay_base_color",
"overlay_option_active_color",
"overlay_option_manual_override_color",
"points_primary_color",
Expand Down
2 changes: 1 addition & 1 deletion interface/reset_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def execute(self, context):
get_preferences().overlay_header_standard_color = (255/255, 135/255, 55/255)
get_preferences().overlay_header_recalled_color = (82/255, 224/255, 82/255)
get_preferences().overlay_header_paused_color = (238/255, 59/255, 43/255)
get_preferences().overlay_option_active_color = (55/255, 174/255, 255/255)
get_preferences().overlay_base_color = (255/255, 255/255, 255/255)
get_preferences().overlay_option_manual_override_color = (237/255, 185/255, 94/255)

# Points
Expand Down
27 changes: 15 additions & 12 deletions lib/overlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,18 @@ def draw_property(cls, property_content, metadata_content, active=False, alt_mod
blf.size(0, 28, cls.dpi)

is_ok, is_value, is_raw = input_stream or (False, None, None)
base_r, base_g, base_b = get_preferences().overlay_base_color

if cls.operator_passthrough:
blf.color(0, 255/255, 255/255, 255/255, 0.2)
blf.color(0, base_r, base_g, base_b, 0.2)
elif is_value is not None and active:
r, g, b = get_preferences().overlay_option_manual_override_color
blf.color(0, r, g, b, 1.0)
elif active:
r, g, b = get_preferences().overlay_option_active_color
blf.color(0, r, g, b, 1.0)
else:
blf.color(0, 255/255, 255/255, 255/255, 0.1)
blf.color(0, base_r, base_g, base_b, 0.1)

blf.position(0, cls.overlay_x, cls.overlay_y - ((38 * cls.dpi_scalar) + (cls.line_spacer * cls.line_step)), 0)

Expand All @@ -189,19 +190,19 @@ def draw_property(cls, property_content, metadata_content, active=False, alt_mod
blf.size(0, 16, cls.dpi)

if cls.operator_passthrough:
blf.color(0, 255/255, 255/255, 255/255, 0.2)
blf.color(0, base_r, base_g, base_b, 0.2)
else:
blf.color(0, 255/255, 255/255, 255/255, 1.0)
blf.color(0, base_r, base_g, base_b, 1.0)

blf.position(0, cls.overlay_x + (25 * cls.dpi_scalar), cls.overlay_y - ((25 * cls.dpi_scalar) + (cls.line_spacer * cls.line_step)), 0)
blf.draw(0, property_content)

blf.size(0, 11, cls.dpi)

if cls.operator_passthrough:
blf.color(0, 255/255, 255/255, 255/255, 0.2)
blf.color(0, base_r, base_g, base_b, 0.2)
else:
blf.color(0, 255/255, 255/255, 255/255, 0.3)
blf.color(0, base_r, base_g, base_b, 0.3)

blf.position(0, cls.overlay_x + (25 * cls.dpi_scalar), cls.overlay_y - ((40 * cls.dpi_scalar) + (cls.line_spacer * cls.line_step)), 0)

Expand All @@ -215,31 +216,33 @@ def draw_property(cls, property_content, metadata_content, active=False, alt_mod

def draw_hint(cls, hint_content, metadata_content):
blf.size(0, 22, cls.dpi)

base_r, base_g, base_b = get_preferences().overlay_base_color

if cls.operator_passthrough:
blf.color(0, 255/255, 255/255, 255/255, 0.2)
blf.color(0, base_r, base_g, base_b, 0.2)
else:
blf.color(0, 255/255, 255/255, 255/255, 0.5)
blf.color(0, base_r, base_g, base_b, 0.5)

blf.position(0, cls.overlay_x - (3 * cls.dpi_scalar), cls.overlay_y - ((36 * cls.dpi_scalar) + (cls.line_spacer * cls.line_step)), 0)
blf.draw(0, "◈")

blf.size(0, 16, cls.dpi)

if cls.operator_passthrough:
blf.color(0, 255/255, 255/255, 255/255, 0.2)
blf.color(0, base_r, base_g, base_b, 0.2)
else:
blf.color(0, 255/255, 255/255, 255/255, 1.0)
blf.color(0, base_r, base_g, base_b, 1.0)

blf.position(0, cls.overlay_x + (25 * cls.dpi_scalar), cls.overlay_y - ((25 * cls.dpi_scalar) + (cls.line_spacer * cls.line_step)), 0)
blf.draw(0, hint_content)

blf.size(0, 11, cls.dpi)

if cls.operator_passthrough:
blf.color(0, 255/255, 255/255, 255/255, 0.2)
blf.color(0, base_r, base_g, base_b, 0.2)
else:
blf.color(0, 255/255, 255/255, 255/255, 0.3)
blf.color(0, base_r, base_g, base_b, 0.3)

blf.position(0, cls.overlay_x + (25 * cls.dpi_scalar), cls.overlay_y - ((40 * cls.dpi_scalar) + (cls.line_spacer * cls.line_step)), 0)
blf.draw(0, metadata_content)
Expand Down

0 comments on commit b6fb7df

Please sign in to comment.