summaryrefslogtreecommitdiff
path: root/src/gmdocument.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-08-26 07:24:34 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-08-26 07:24:34 +0300
commita78d7cb111096964d466fe045ada7f67e347c1eb (patch)
treeace3de7f045a6b1918f22a282dba59fdd2be8293 /src/gmdocument.c
parent51a9618e72450c8a50a8d4f1fd2cb3b4921a537d (diff)
Content theme tweaks
Green background shouldn't be so saturated.
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r--src/gmdocument.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c
index 19c11179..46ca106f 100644
--- a/src/gmdocument.c
+++ b/src/gmdocument.c
@@ -690,6 +690,20 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
690 } 690 }
691 /* Set up colors. */ 691 /* Set up colors. */
692 if (d->themeSeed) { 692 if (d->themeSeed) {
693 enum iHue {
694 red_Hue,
695 reddishOrange_Hue,
696 yellowishOrange_Hue,
697 yellow_Hue,
698 greenishYellow_Hue,
699 green_Hue,
700 bluishGreen_Hue,
701 cyan_Hue,
702 skyBlue_Hue,
703 blue_Hue,
704 violet_Hue,
705 pink_Hue
706 };
693 static const float hues[] = { 5, 25, 40, 56, 80, 120, 160, 180, 208, 231, 270, 324 }; 707 static const float hues[] = { 5, 25, 40, 56, 80, 120, 160, 180, 208, 231, 270, 324 };
694 static const struct { 708 static const struct {
695 int index[2]; 709 int index[2];
@@ -707,9 +721,9 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
707 { 8, 9 }, /* violet */ 721 { 8, 9 }, /* violet */
708 { 7, 8 }, /* pink */ 722 { 7, 8 }, /* pink */
709 }; 723 };
710 const float saturationLevel = 1.0f; /* TODO: user setting */
711 const iBool isBannerLighter = (d->themeSeed & 0x4000) != 0; 724 const iBool isBannerLighter = (d->themeSeed & 0x4000) != 0;
712 const size_t primIndex = d->themeSeed ? (d->themeSeed & 0xff) % iElemCount(hues) : 2; 725 const size_t primIndex = d->themeSeed ? (d->themeSeed & 0xff) % iElemCount(hues) : 2;
726 const float saturationLevel = 1.0f; /* TODO: user setting */
713 const iBool isDarkBgSat = 727 const iBool isDarkBgSat =
714 (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); 728 (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4);
715 iHSLColor base = { hues[primIndex], 729 iHSLColor base = { hues[primIndex],
@@ -718,9 +732,10 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
718 1.0f }; 732 1.0f };
719 // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); 733 // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum);
720 // printf("isDarkBgSat: %d\n", isDarkBgSat); 734 // printf("isDarkBgSat: %d\n", isDarkBgSat);
721 setHsl_Color(tmBackground_ColorId, base); 735 iHSLColor bgBase = base;
736 setHsl_Color(tmBackground_ColorId, bgBase);
722 737
723 setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0.1f, 0.04f * (isBannerLighter ? 1 : -1))); 738 setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(bgBase, 0.1f, 0.04f * (isBannerLighter ? 1 : -1)));
724 setHsl_Color(tmBannerTitle_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.1f, 0), 0.55f)); 739 setHsl_Color(tmBannerTitle_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.1f, 0), 0.55f));
725 setHsl_Color(tmBannerIcon_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.35f, 0), 0.65f)); 740 setHsl_Color(tmBannerIcon_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.35f, 0), 0.65f));
726 741
@@ -779,7 +794,12 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) {
779 if (isDarkBgSat) { 794 if (isDarkBgSat) {
780 /* Saturate background, desaturate text. */ 795 /* Saturate background, desaturate text. */
781 if (isBackground_ColorId(i)) { 796 if (isBackground_ColorId(i)) {
782 color.sat = (color.sat + 1) / 2; 797 if (primIndex != green_Hue) {
798 color.sat = (color.sat + 1) / 2;
799 }
800 else {
801 color.sat *= 0.5f;
802 }
783 color.lum *= 0.75f; 803 color.lum *= 0.75f;
784 } 804 }
785 else if (isText_ColorId(i)) { 805 else if (isText_ColorId(i)) {