summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-03 15:01:38 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-03 15:01:38 +0200
commite035d2b4126d3c7b4982e88b7be9086f1b0d5ddd (patch)
treead3d61c1e119b4282af4b024c350351464c3ff94
parent5b1b19d6d0e07103cdeb8df2dcd838fe67a923cd (diff)
GmDocument: Tuning Colorful Dark
Some background colors (pink, green) were too saturated and out of place.
-rw-r--r--src/gmdocument.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index f5ce90a1..dddcde9a 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -950,7 +950,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
950 violet_Hue, 950 violet_Hue,
951 pink_Hue 951 pink_Hue
952 }; 952 };
953 static const float hues[] = { 5, 25, 40, 56, 80 + 15, 120, 160, 180, 208, 231, 270, 324 }; 953 static const float hues[] = { 5, 25, 40, 56, 80 + 15, 120, 160, 180, 208, 231, 270, 324 + 10 };
954 static const struct { 954 static const struct {
955 int index[2]; 955 int index[2];
956 } altHues[iElemCount(hues)] = { 956 } altHues[iElemCount(hues)] = {
@@ -994,10 +994,11 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
994 setHsl_Color(tmBannerTitle_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.1f, 0), 0.55f)); 994 setHsl_Color(tmBannerTitle_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.1f, 0), 0.55f));
995 setHsl_Color(tmBannerIcon_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.35f, 0), 0.65f)); 995 setHsl_Color(tmBannerIcon_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.35f, 0), 0.65f));
996 996
997// printf("primHue: %zu alts: %d %d\n", 997// printf("primHue: %zu alts: %d %d isDarkBgSat: %d\n",
998// primIndex, 998// primIndex,
999// altHues[primIndex].index[altIndex[0]], 999// altHues[primIndex].index[altIndex[0]],
1000// altHues[primIndex].index[altIndex[1]]); 1000// altHues[primIndex].index[altIndex[1]],
1001// isDarkBgSat);
1001 1002
1002 const float titleLum = 0.2f * ((d->themeSeed >> 17) & 0x7) / 7.0f; 1003 const float titleLum = 0.2f * ((d->themeSeed >> 17) & 0x7) / 7.0f;
1003 setHsl_Color(tmHeading1_ColorId, setLum_HSLColor(altBase, titleLum + 0.80f)); 1004 setHsl_Color(tmHeading1_ColorId, setLum_HSLColor(altBase, titleLum + 0.80f));
@@ -1014,8 +1015,8 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
1014 1015
1015 if (delta_Color(get_Color(tmHeading3_ColorId), get_Color(tmParagraph_ColorId)) <= 80) { 1016 if (delta_Color(get_Color(tmHeading3_ColorId), get_Color(tmParagraph_ColorId)) <= 80) {
1016 /* Smallest headings may be too close to body text color. */ 1017 /* Smallest headings may be too close to body text color. */
1017 setHsl_Color(tmHeading2_ColorId, addSatLum_HSLColor(get_HSLColor(tmHeading2_ColorId), 0.5f, -0.12f)); 1018 setHsl_Color(tmHeading2_ColorId, addSatLum_HSLColor(get_HSLColor(tmHeading2_ColorId), 0.4f, -0.12f));
1018 setHsl_Color(tmHeading3_ColorId, addSatLum_HSLColor(get_HSLColor(tmHeading3_ColorId), 0.5f, -0.2f)); 1019 setHsl_Color(tmHeading3_ColorId, addSatLum_HSLColor(get_HSLColor(tmHeading3_ColorId), 0.4f, -0.2f));
1019 } 1020 }
1020 1021
1021 setHsl_Color(tmFirstParagraph_ColorId, addSatLum_HSLColor(base, 0.2f, 0.72f)); 1022 setHsl_Color(tmFirstParagraph_ColorId, addSatLum_HSLColor(base, 0.2f, 0.72f));
@@ -1088,7 +1089,10 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
1088 if (isDarkBgSat) { 1089 if (isDarkBgSat) {
1089 /* Saturate background, desaturate text. */ 1090 /* Saturate background, desaturate text. */
1090 if (isBackground_ColorId(i)) { 1091 if (isBackground_ColorId(i)) {
1091 if (primIndex != green_Hue) { 1092 if (primIndex == pink_Hue) {
1093 color.sat = (4 * color.sat + 1) / 5;
1094 }
1095 else if (primIndex != green_Hue) {
1092 color.sat = (color.sat + 1) / 2; 1096 color.sat = (color.sat + 1) / 2;
1093 } 1097 }
1094 else { 1098 else {
@@ -1104,6 +1108,12 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
1104 /* Desaturate background, saturate text. */ 1108 /* Desaturate background, saturate text. */
1105 if (isBackground_ColorId(i)) { 1109 if (isBackground_ColorId(i)) {
1106 color.sat *= 0.333f; 1110 color.sat *= 0.333f;
1111 if (primIndex == pink_Hue) {
1112 color.sat *= 0.5f;
1113 }
1114 if (primIndex == greenishYellow_Hue || primIndex == green_Hue) {
1115 color.sat *= 0.333f;
1116 }
1107 } 1117 }
1108 else if (isText_ColorId(i)) { 1118 else if (isText_ColorId(i)) {
1109 color.sat = (color.sat + 2) / 3; 1119 color.sat = (color.sat + 2) / 3;