diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-16 16:15:30 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-16 16:15:30 +0300 |
commit | 027d8185b10632092508bfda62467d24c9f8655b (patch) | |
tree | 03b0bf1edb9f2f284afde1679e24ac390b2f201d /src/gmdocument.c | |
parent | b10087331ff28acbc368361ba14dba3a70b7dc90 (diff) |
Palette has UI colors; defined Light theme colors
Diffstat (limited to 'src/gmdocument.c')
-rw-r--r-- | src/gmdocument.c | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index 52ff1654..c943dfe9 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -574,6 +574,7 @@ void reset_GmDocument(iGmDocument *d) { | |||
574 | } | 574 | } |
575 | 575 | ||
576 | void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | 576 | void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { |
577 | const iBool isLightMode = (colorTheme_App() == light_ColorTheme); | ||
577 | static const iChar siteIcons[] = { | 578 | static const iChar siteIcons[] = { |
578 | 0x203b, 0x2042, 0x205c, 0x2182, 0x25ed, 0x2600, 0x2601, 0x2604, 0x2605, 0x2606, | 579 | 0x203b, 0x2042, 0x205c, 0x2182, 0x25ed, 0x2600, 0x2601, 0x2604, 0x2605, 0x2606, |
579 | 0x265c, 0x265e, 0x2690, 0x2691, 0x2693, 0x2698, 0x2699, 0x26f0, 0x270e, 0x2728, | 580 | 0x265c, 0x265e, 0x2690, 0x2691, 0x2693, 0x2698, 0x2699, 0x26f0, 0x270e, 0x2728, |
@@ -585,19 +586,36 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
585 | d->themeSeed = 0; | 586 | d->themeSeed = 0; |
586 | d->siteIcon = 0; | 587 | d->siteIcon = 0; |
587 | /* Default colors. */ { | 588 | /* Default colors. */ { |
588 | const iHSLColor base = { 0, 0, 0.15f, 1.0f }; | 589 | if (!isLightMode) { |
589 | setHsl_Color(tmBackground_ColorId, base); | 590 | const iHSLColor base = { 0, 0, 0.15f, 1.0f }; |
590 | set_Color(tmParagraph_ColorId, get_Color(gray75_ColorId)); | 591 | setHsl_Color(tmBackground_ColorId, base); |
591 | setHsl_Color(tmFirstParagraph_ColorId, addSatLum_HSLColor(base, 0, 0.75f)); | 592 | set_Color(tmParagraph_ColorId, get_Color(gray75_ColorId)); |
592 | set_Color(tmQuote_ColorId, get_Color(cyan_ColorId)); | 593 | setHsl_Color(tmFirstParagraph_ColorId, addSatLum_HSLColor(base, 0, 0.75f)); |
593 | set_Color(tmPreformatted_ColorId, get_Color(cyan_ColorId)); | 594 | set_Color(tmQuote_ColorId, get_Color(cyan_ColorId)); |
594 | set_Color(tmHeading1_ColorId, get_Color(white_ColorId)); | 595 | set_Color(tmPreformatted_ColorId, get_Color(cyan_ColorId)); |
595 | setHsl_Color(tmHeading2_ColorId, addSatLum_HSLColor(base, 0, 0.7f)); | 596 | set_Color(tmHeading1_ColorId, get_Color(white_ColorId)); |
596 | setHsl_Color(tmHeading3_ColorId, addSatLum_HSLColor(base, 0, 0.6f)); | 597 | setHsl_Color(tmHeading2_ColorId, addSatLum_HSLColor(base, 0, 0.7f)); |
597 | set_Color(tmBannerBackground_ColorId, get_Color(black_ColorId)); | 598 | setHsl_Color(tmHeading3_ColorId, addSatLum_HSLColor(base, 0, 0.6f)); |
598 | set_Color(tmBannerTitle_ColorId, get_Color(white_ColorId)); | 599 | set_Color(tmBannerBackground_ColorId, get_Color(black_ColorId)); |
599 | set_Color(tmBannerIcon_ColorId, get_Color(orange_ColorId)); | 600 | set_Color(tmBannerTitle_ColorId, get_Color(white_ColorId)); |
600 | set_Color(tmInlineContentMetadata_ColorId, get_Color(cyan_ColorId)); | 601 | set_Color(tmBannerIcon_ColorId, get_Color(orange_ColorId)); |
602 | set_Color(tmInlineContentMetadata_ColorId, get_Color(cyan_ColorId)); | ||
603 | } | ||
604 | else { | ||
605 | const iHSLColor base = { 0, 0, 1.0f, 1.0f }; | ||
606 | setHsl_Color(tmBackground_ColorId, base); | ||
607 | set_Color(tmParagraph_ColorId, get_Color(gray25_ColorId)); | ||
608 | set_Color(tmFirstParagraph_ColorId, get_Color(black_ColorId)); | ||
609 | set_Color(tmQuote_ColorId, get_Color(brown_ColorId)); | ||
610 | set_Color(tmPreformatted_ColorId, get_Color(brown_ColorId)); | ||
611 | set_Color(tmHeading1_ColorId, get_Color(black_ColorId)); | ||
612 | setHsl_Color(tmHeading2_ColorId, addSatLum_HSLColor(base, 0, -0.7f)); | ||
613 | setHsl_Color(tmHeading3_ColorId, addSatLum_HSLColor(base, 0, -0.6f)); | ||
614 | set_Color(tmBannerBackground_ColorId, get_Color(white_ColorId)); | ||
615 | set_Color(tmBannerTitle_ColorId, get_Color(gray50_ColorId)); | ||
616 | set_Color(tmBannerIcon_ColorId, get_Color(teal_ColorId)); | ||
617 | set_Color(tmInlineContentMetadata_ColorId, get_Color(brown_ColorId)); | ||
618 | } | ||
601 | set_Color(tmBadLink_ColorId, get_Color(red_ColorId)); | 619 | set_Color(tmBadLink_ColorId, get_Color(red_ColorId)); |
602 | set_Color(tmLinkText_ColorId, get_Color(white_ColorId)); | 620 | set_Color(tmLinkText_ColorId, get_Color(white_ColorId)); |
603 | set_Color(tmLinkIcon_ColorId, get_Color(cyan_ColorId)); | 621 | set_Color(tmLinkIcon_ColorId, get_Color(cyan_ColorId)); |
@@ -639,17 +657,17 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
639 | { 8, 9 }, /* violet */ | 657 | { 8, 9 }, /* violet */ |
640 | { 7, 8 }, /* pink */ | 658 | { 7, 8 }, /* pink */ |
641 | }; | 659 | }; |
642 | const float saturationLevel = 1.0f; /* TODO: user setting */ | 660 | const float saturationLevel = 1.0f; /* TODO: user setting */ |
643 | const iBool isLightMode = iFalse; /* TODO: user setting */ | 661 | const iBool isBannerLighter = (d->themeSeed & 0x4000) != 0; |
644 | const iBool isBannerLighter = (d->themeSeed & 0x4000) != 0; | ||
645 | const size_t primIndex = (d->themeSeed & 0xff) % iElemCount(hues); | 662 | const size_t primIndex = (d->themeSeed & 0xff) % iElemCount(hues); |
646 | const iBool isDarkBgSat = (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); | 663 | const iBool isDarkBgSat = |
647 | iHSLColor base = { hues[primIndex], | 664 | (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); |
665 | iHSLColor base = { hues[primIndex], | ||
648 | 0.8f * (d->themeSeed >> 24) / 255.0f, | 666 | 0.8f * (d->themeSeed >> 24) / 255.0f, |
649 | 0.06f + 0.09f * ((d->themeSeed >> 5) & 0x7) / 7.0f, | 667 | 0.06f + 0.09f * ((d->themeSeed >> 5) & 0x7) / 7.0f, |
650 | 1.0f }; | 668 | 1.0f }; |
651 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); | 669 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); |
652 | // printf("isDarkBgSat: %d\n", isDarkBgSat); | 670 | // printf("isDarkBgSat: %d\n", isDarkBgSat); |
653 | setHsl_Color(tmBackground_ColorId, base); | 671 | setHsl_Color(tmBackground_ColorId, base); |
654 | 672 | ||
655 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0.1f, 0.04f * (isBannerLighter ? 1 : -1))); | 673 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0.1f, 0.04f * (isBannerLighter ? 1 : -1))); |