diff options
-rw-r--r-- | src/gmdocument.c | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 1722bba5..7982d57b 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -714,18 +714,26 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
714 | set_Color(tmBannerIcon_ColorId, get_Color(orange_ColorId)); | 714 | set_Color(tmBannerIcon_ColorId, get_Color(orange_ColorId)); |
715 | } | 715 | } |
716 | else if (theme == colorfulLight_GmDocumentTheme) { | 716 | else if (theme == colorfulLight_GmDocumentTheme) { |
717 | const iHSLColor base = { 190, 1.0f, 0.35f, 1.0f }; | 717 | const iHSLColor base = addSatLum_HSLColor(get_HSLColor(teal_ColorId), -0.3f, 0.5f); |
718 | setHsl_Color(tmBackground_ColorId, base); | 718 | setHsl_Color(tmBackground_ColorId, base); |
719 | set_Color(tmParagraph_ColorId, get_Color(black_ColorId)); | 719 | set_Color(tmParagraph_ColorId, get_Color(black_ColorId)); |
720 | set_Color(tmFirstParagraph_ColorId, get_Color(black_ColorId)); | 720 | set_Color(tmFirstParagraph_ColorId, get_Color(black_ColorId)); |
721 | setHsl_Color(tmQuote_ColorId, addSatLum_HSLColor(base, 0, -0.2f)); | 721 | setHsl_Color(tmQuote_ColorId, addSatLum_HSLColor(base, 0, -0.25f)); |
722 | setHsl_Color(tmPreformatted_ColorId, addSatLum_HSLColor(base, 0, -0.3f)); | 722 | setHsl_Color(tmPreformatted_ColorId, addSatLum_HSLColor(base, 0, -0.3f)); |
723 | set_Color(tmHeading1_ColorId, get_Color(white_ColorId)); | 723 | set_Color(tmHeading1_ColorId, get_Color(white_ColorId)); |
724 | set_Color(tmHeading2_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(white_ColorId), 0.85f)); | 724 | set_Color(tmHeading2_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(black_ColorId), 0.67f)); |
725 | set_Color(tmHeading3_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(white_ColorId), 0.75f)); | 725 | set_Color(tmHeading3_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(black_ColorId), 0.55f)); |
726 | setHsl_Color(tmBannerBackground_ColorId, base); | 726 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0, -0.1f)); |
727 | setHsl_Color(tmBannerIcon_ColorId, addSatLum_HSLColor(base, 0, -0.2f)); | 727 | setHsl_Color(tmBannerIcon_ColorId, addSatLum_HSLColor(base, 0, -0.2f)); |
728 | setHsl_Color(tmBannerTitle_ColorId, addSatLum_HSLColor(base, 0, -0.2f)); | 728 | setHsl_Color(tmBannerTitle_ColorId, addSatLum_HSLColor(base, 0, -0.2f)); |
729 | setHsl_Color(tmLinkIcon_ColorId, addSatLum_HSLColor(get_HSLColor(teal_ColorId), 0, 0.15f)); | ||
730 | set_Color(tmLinkIconVisited_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(teal_ColorId), 0.35f)); | ||
731 | set_Color(tmLinkDomain_ColorId, get_Color(teal_ColorId)); | ||
732 | setHsl_Color(tmHypertextLinkIcon_ColorId, get_HSLColor(white_ColorId)); | ||
733 | set_Color(tmHypertextLinkIconVisited_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(white_ColorId), 0.5f)); | ||
734 | set_Color(tmHypertextLinkDomain_ColorId, get_Color(brown_ColorId)); | ||
735 | setHsl_Color(tmGopherLinkIcon_ColorId, addSatLum_HSLColor(get_HSLColor(tmGopherLinkIcon_ColorId), 0, -0.25f)); | ||
736 | setHsl_Color(tmGopherLinkTextHover_ColorId, addSatLum_HSLColor(get_HSLColor(tmGopherLinkTextHover_ColorId), 0, -0.3f)); | ||
729 | } | 737 | } |
730 | else if (theme == black_GmDocumentTheme) { | 738 | else if (theme == black_GmDocumentTheme) { |
731 | set_Color(tmBackground_ColorId, get_Color(black_ColorId)); | 739 | set_Color(tmBackground_ColorId, get_Color(black_ColorId)); |
@@ -828,8 +836,6 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
828 | pink_Hue | 836 | pink_Hue |
829 | }; | 837 | }; |
830 | static const float hues[] = { 5, 25, 40, 56, 80, 120, 160, 180, 208, 231, 270, 324 }; | 838 | static const float hues[] = { 5, 25, 40, 56, 80, 120, 160, 180, 208, 231, 270, 324 }; |
831 | static const float normLum[] = { 0.65f, 0.5f, 0.4f, 0.45f, 0.35f, 0.45f, | ||
832 | 0.35f, 0.35f, 0.55f, 0.7f, 0.7f, 0.65f }; | ||
833 | static const struct { | 839 | static const struct { |
834 | int index[2]; | 840 | int index[2]; |
835 | } altHues[iElemCount(hues)] = { | 841 | } altHues[iElemCount(hues)] = { |
@@ -856,8 +862,9 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
856 | const iBool isDarkBgSat = | 862 | const iBool isDarkBgSat = |
857 | (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); | 863 | (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); |
858 | 864 | ||
859 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); | 865 | static const float normLum[] = { 0.8f, 0.7f, 0.675f, 0.65f, 0.55f, |
860 | // printf("isDarkBgSat: %d\n", isDarkBgSat); | 866 | 0.6f, 0.475f, 0.475f, 0.75f, 0.8f, |
867 | 0.85f, 0.85f }; | ||
861 | 868 | ||
862 | if (theme == colorfulDark_GmDocumentTheme) { | 869 | if (theme == colorfulDark_GmDocumentTheme) { |
863 | iHSLColor base = { hues[primIndex], | 870 | iHSLColor base = { hues[primIndex], |
@@ -903,29 +910,29 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
903 | set_Color(tmInlineContentMetadata_ColorId, get_Color(tmHeading3_ColorId)); | 910 | set_Color(tmInlineContentMetadata_ColorId, get_Color(tmHeading3_ColorId)); |
904 | } | 911 | } |
905 | else if (theme == colorfulLight_GmDocumentTheme) { | 912 | else if (theme == colorfulLight_GmDocumentTheme) { |
913 | // static int primIndex = 0; | ||
914 | // primIndex = (primIndex + 1) % iElemCount(hues); | ||
906 | iHSLColor base = { hues[primIndex], 1.0f, normLum[primIndex], 1.0f }; | 915 | iHSLColor base = { hues[primIndex], 1.0f, normLum[primIndex], 1.0f }; |
907 | printf("prim:%d norm:%f\n", primIndex, normLum[primIndex]); fflush(stdout); | 916 | // printf("prim:%d norm:%f\n", primIndex, normLum[primIndex]); fflush(stdout); |
908 | if (primIndex == 1) { | 917 | static const float normSat[] = { |
909 | base.sat -= 0.1f; | 918 | 0.85f, 0.9f, 1, 0.65f, 0.65f, |
910 | } | 919 | 0.65f, 0.9f, 0.9f, 1, 0.9f, |
911 | if (primIndex == 0 || primIndex == 3 || primIndex == 5 || primIndex == 11) { | 920 | 1, 0.75f |
912 | base.sat -= 0.25f; | 921 | }; |
913 | } | 922 | iBool darkHeadings = iTrue; |
914 | if (primIndex == 3) { | 923 | base.sat *= normSat[primIndex] * 0.8f; |
915 | base.sat -= 0.2f; | ||
916 | } | ||
917 | base.sat *= 0.8f; | ||
918 | setHsl_Color(tmBackground_ColorId, base); | 924 | setHsl_Color(tmBackground_ColorId, base); |
919 | set_Color(tmParagraph_ColorId, get_Color(black_ColorId)); | 925 | set_Color(tmParagraph_ColorId, get_Color(black_ColorId)); |
920 | set_Color(tmFirstParagraph_ColorId, get_Color(black_ColorId)); | 926 | set_Color(tmFirstParagraph_ColorId, get_Color(black_ColorId)); |
921 | setHsl_Color(tmQuote_ColorId, addSatLum_HSLColor(base, 0, -base.lum * 0.5f)); | 927 | setHsl_Color(tmQuote_ColorId, addSatLum_HSLColor(base, 0, -base.lum * 0.67f)); |
922 | setHsl_Color(tmPreformatted_ColorId, addSatLum_HSLColor(base, 0, -base.lum * 0.67f)); | 928 | setHsl_Color(tmPreformatted_ColorId, addSatLum_HSLColor(base, 0, -base.lum * 0.75f)); |
923 | set_Color(tmHeading1_ColorId, get_Color(white_ColorId)); | 929 | set_Color(tmHeading1_ColorId, get_Color(white_ColorId)); |
924 | set_Color(tmHeading2_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(white_ColorId), 0.85f)); | 930 | set_Color(tmHeading2_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(darkHeadings ? black_ColorId : white_ColorId), 0.7f)); |
925 | set_Color(tmHeading3_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(white_ColorId), 0.75f)); | 931 | set_Color(tmHeading3_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(darkHeadings ? black_ColorId : white_ColorId), 0.6f)); |
926 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0, -0.04f)); | 932 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0, -0.04f)); |
927 | setHsl_Color(tmBannerIcon_ColorId, addSatLum_HSLColor(base, 0, -0.3f)); | 933 | setHsl_Color(tmBannerIcon_ColorId, addSatLum_HSLColor(base, 0, -0.3f)); |
928 | setHsl_Color(tmBannerTitle_ColorId, addSatLum_HSLColor(base, 0, -0.25f)); | 934 | setHsl_Color(tmBannerTitle_ColorId, addSatLum_HSLColor(base, 0, -0.25f)); |
935 | set_Color(tmLinkIconVisited_ColorId, mix_Color(get_Color(tmBackground_ColorId), get_Color(teal_ColorId), 0.3f)); | ||
929 | } | 936 | } |
930 | else if (theme == white_GmDocumentTheme) { | 937 | else if (theme == white_GmDocumentTheme) { |
931 | iHSLColor base = { hues[primIndex], 1.0f, 0.3f, 1.0f }; | 938 | iHSLColor base = { hues[primIndex], 1.0f, 0.3f, 1.0f }; |
@@ -950,7 +957,7 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
950 | const float primHue = hues[primIndex]; | 957 | const float primHue = hues[primIndex]; |
951 | const iHSLColor primBright = { primHue, 1, 0.6f, 1 }; | 958 | const iHSLColor primBright = { primHue, 1, 0.6f, 1 }; |
952 | const iHSLColor primDim = { primHue, 1, dimLightness_(primHue, theme == black_GmDocumentTheme ? 0.25f : 0.45f), 1}; | 959 | const iHSLColor primDim = { primHue, 1, dimLightness_(primHue, theme == black_GmDocumentTheme ? 0.25f : 0.45f), 1}; |
953 | const iHSLColor altBright = { altHue, 1, 0.6f, 1 }; | 960 | const iHSLColor altBright = { altHue, 1, normLum[altIndex[0]] + (theme == gray_GmDocumentTheme ? 0.1f : 0.0f), 1 }; |
954 | setHsl_Color(tmQuote_ColorId, altBright); | 961 | setHsl_Color(tmQuote_ColorId, altBright); |
955 | setHsl_Color(tmPreformatted_ColorId, altBright); | 962 | setHsl_Color(tmPreformatted_ColorId, altBright); |
956 | setHsl_Color(tmHeading1_ColorId, primBright); | 963 | setHsl_Color(tmHeading1_ColorId, primBright); |