summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-05-25 00:53:22 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-06-04 15:38:12 +0200
commitab90ce6f21e6adef70d39f08749ce9fcf30bcbd6 (patch)
tree3a6410d1e84a1dd3a35c28c07134fe1a2ca6b944 /include
parent433a2ced036b8522a60559d9ca6387e5b478e3a9 (diff)
tdf#153361 improve theme color generation in color picker
The theme color generator needs to take color luminocity into account, so that the very dark or very light colors are properly shaded. Otherwise a too dark color will generate a too dark (almost black) color variant, or a too light a too light (almost white) color variant. However those colors aren't useful. Change-Id: Id803a8f6f1a79cbc822ed2d7faca9bec228c0188 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152237 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> (cherry picked from commit e6215c7233c0fb437a81b51c8a8a30bb53eef65f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152517 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/svx/PaletteManager.hxx25
-rw-r--r--include/svx/strings.hrc15
2 files changed, 29 insertions, 11 deletions
diff --git a/include/svx/PaletteManager.hxx b/include/svx/PaletteManager.hxx
index c6d1712a12f4..37d22b92ec64 100644
--- a/include/svx/PaletteManager.hxx
+++ b/include/svx/PaletteManager.hxx
@@ -32,6 +32,26 @@ namespace com::sun::star::uno { class XComponentContext; }
namespace svx { class ToolboxButtonColorUpdaterBase; }
namespace weld { class Window; }
+enum class ThemePaletteColorType
+{
+ Black,
+ White,
+ Low,
+ High,
+ Normal
+};
+
+struct ThemePaletteData
+{
+ ThemePaletteColorType meType = ThemePaletteColorType::Normal;
+ Color maColor;
+};
+
+struct ThemePaletteCollection
+{
+ std::array<ThemePaletteData, 12> maData;
+};
+
class SVXCORE_DLLPUBLIC PaletteManager
{
const sal_uInt16 mnMaxRecentColors;
@@ -49,6 +69,7 @@ class SVXCORE_DLLPUBLIC PaletteManager
ColorSelectFunction maColorSelectFunction;
std::unique_ptr<SvColorDialog> m_pColorDlg;
+ std::optional<ThemePaletteCollection> moThemePaletteCollection;
PaletteManager(const PaletteManager* pClone);
public:
@@ -79,8 +100,8 @@ public:
PaletteManager* Clone() const;
- static void GetThemeIndexLumModOff(sal_uInt16 nItemId, sal_Int16& rThemeIndex,
- sal_Int16& rLumMod, sal_Int16& rLumOff);
+ static bool GetThemeAndEffectIndex(sal_uInt16 nItemId, sal_uInt16& rThemeIndex, sal_uInt16& rEffectIndex);
+ bool GetLumModOff(sal_uInt16 nThemeIndex, sal_uInt16 nEffect, sal_Int16& rLumMod, sal_Int16& rLumOff);
static void DispatchColorCommand(const OUString& aCommand, const NamedColor& rColor);
};
diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 6f8a353a4204..86422a9a63a8 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1121,10 +1121,10 @@
#define RID_SVXSTR_DOC_COLORS NC_("RID_SVXSTR_DOC_COLORS", "Document colors")
#define RID_SVXSTR_THEME_COLORS NC_("RID_SVXSTR_THEME_COLORS", "Theme colors")
#define RID_SVXSTR_DOC_COLOR_PREFIX NC_("RID_SVXSTR_DOC_COLOR_PREFIX", "Document Color")
-#define RID_SVXSTR_THEME_COLOR1 NC_("RID_SVXSTR_THEME_COLOR1", "Background - Dark 1")
-#define RID_SVXSTR_THEME_COLOR2 NC_("RID_SVXSTR_THEME_COLOR2", "Text - Light 1")
-#define RID_SVXSTR_THEME_COLOR3 NC_("RID_SVXSTR_THEME_COLOR3", "Background - Dark 2")
-#define RID_SVXSTR_THEME_COLOR4 NC_("RID_SVXSTR_THEME_COLOR4", "Text - Light 2")
+#define RID_SVXSTR_THEME_COLOR1 NC_("RID_SVXSTR_THEME_COLOR1", "Dark 1")
+#define RID_SVXSTR_THEME_COLOR2 NC_("RID_SVXSTR_THEME_COLOR2", "Light 1")
+#define RID_SVXSTR_THEME_COLOR3 NC_("RID_SVXSTR_THEME_COLOR3", "Dark 2")
+#define RID_SVXSTR_THEME_COLOR4 NC_("RID_SVXSTR_THEME_COLOR4", "Light 2")
#define RID_SVXSTR_THEME_COLOR5 NC_("RID_SVXSTR_THEME_COLOR5", "Accent 1")
#define RID_SVXSTR_THEME_COLOR6 NC_("RID_SVXSTR_THEME_COLOR6", "Accent 2")
#define RID_SVXSTR_THEME_COLOR7 NC_("RID_SVXSTR_THEME_COLOR7", "Accent 3")
@@ -1133,11 +1133,8 @@
#define RID_SVXSTR_THEME_COLOR10 NC_("RID_SVXSTR_THEME_COLOR10", "Accent 6")
#define RID_SVXSTR_THEME_COLOR11 NC_("RID_SVXSTR_THEME_COLOR11", "Hyperlink")
#define RID_SVXSTR_THEME_COLOR12 NC_("RID_SVXSTR_THEME_COLOR12", "Followed Hyperlink")
-#define RID_SVXSTR_THEME_EFFECT1 NC_("RID_SVXSTR_THEME_EFFECT1", "%1, 80% Lighter")
-#define RID_SVXSTR_THEME_EFFECT2 NC_("RID_SVXSTR_THEME_EFFECT2", "%1, 60% Lighter")
-#define RID_SVXSTR_THEME_EFFECT3 NC_("RID_SVXSTR_THEME_EFFECT3", "%1, 40% Lighter")
-#define RID_SVXSTR_THEME_EFFECT4 NC_("RID_SVXSTR_THEME_EFFECT4", "%1, 25% Darker")
-#define RID_SVXSTR_THEME_EFFECT5 NC_("RID_SVXSTR_THEME_EFFECT5", "%1, 50% Darker")
+#define RID_SVXSTR_THEME_EFFECT_LIGHTER NC_("RID_SVXSTR_THEME_EFFECT_LIGHTER", "$THEME_NAME, $PERCENTAGE% Lighter")
+#define RID_SVXSTR_THEME_EFFECT_DARKER NC_("RID_SVXSTR_THEME_EFFECT_DARKER", "$THEME_NAME, $PERCENTAGE% Darker")
#define RID_SVX_EXTRUSION_BAR NC_("RID_SVX_EXTRUSION_BAR", "Extrusion")
#define RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF NC_("RID_SVXSTR_UNDO_APPLY_EXTRUSION_ON_OFF", "Apply Extrusion On/Off")