Skip to content

Commit

Permalink
Fix text action name being white on light theme
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtryb committed Jul 11, 2024
1 parent 31a99a9 commit 35a413b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ class Color(Enum):
class LabelTextColorizer(QColor):
"""Functions that return a color associated with value of property."""

@staticmethod
def action() -> QColor:
"""Return a QColor associated with action."""
if Krita.is_light_theme_active:
return Color.BLACK.value
return Color.WHITE.value

@classmethod
def blending_mode(cls, mode: BlendingMode) -> QColor:
"""Return a QColor associated with blending mode. Gray by default."""
"""Return a QColor associated with blending mode."""
if Krita.is_light_theme_active:
return cls.BLENDING_MODES_LIGHT[mode].value
return cls.BLENDING_MODES_DARK[mode].value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from api_krita import Krita
from api_krita.enums import Action, Tool, Toggle, TransformMode
from api_krita.actions import TransformModeFinder
from composer_utils.label import LabelText
from composer_utils.label import LabelText, LabelTextColorizer
from ..controller_base import Controller, NumericController


Expand Down Expand Up @@ -68,7 +68,9 @@ def get_label(self, value: Tool) -> QIcon | LabelText:
icon = value.icon
if not icon.isNull():
return value.icon
return LabelText(value.name[:3])
return LabelText(
value=value.name[:3],
color=LabelTextColorizer.action())

def get_pretty_name(self, value: Action) -> str:
"""Forward enums' pretty name."""
Expand Down

0 comments on commit 35a413b

Please sign in to comment.