diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-16 16:47:13 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-16 16:47:13 +0300 |
commit | 6d8bf2508f5e2af36b61cca42ed68cad26c41d56 (patch) | |
tree | fa80ff80181af63ce557ef71fbe8177851fb9ac4 | |
parent | 45a92070bf8681cf3b91ec784a2368e9653e9c5d (diff) |
Further theme color improvements
Default seed colors.
-rw-r--r-- | src/gmdocument.c | 287 | ||||
-rw-r--r-- | src/ui/color.c | 4 | ||||
-rw-r--r-- | src/ui/color.h | 2 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 7 |
4 files changed, 162 insertions, 138 deletions
diff --git a/src/gmdocument.c b/src/gmdocument.c index c943dfe9..83f94a39 100644 --- a/src/gmdocument.c +++ b/src/gmdocument.c | |||
@@ -583,8 +583,6 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
583 | 0x1f306, 0x1f308, 0x1f30a, 0x1f319, 0x1f31f, 0x1f320, 0x1f340, 0x1f4cd, 0x1f4e1, 0x1f531, | 583 | 0x1f306, 0x1f308, 0x1f30a, 0x1f319, 0x1f31f, 0x1f320, 0x1f340, 0x1f4cd, 0x1f4e1, 0x1f531, |
584 | 0x1f533, 0x1f657, 0x1f659, 0x1f665, 0x1f668, 0x1f66b, 0x1f78b, 0x1f796, 0x1f79c, | 584 | 0x1f533, 0x1f657, 0x1f659, 0x1f665, 0x1f668, 0x1f66b, 0x1f78b, 0x1f796, 0x1f79c, |
585 | }; | 585 | }; |
586 | d->themeSeed = 0; | ||
587 | d->siteIcon = 0; | ||
588 | /* Default colors. */ { | 586 | /* Default colors. */ { |
589 | if (!isLightMode) { | 587 | if (!isLightMode) { |
590 | const iHSLColor base = { 0, 0, 0.15f, 1.0f }; | 588 | const iHSLColor base = { 0, 0, 0.15f, 1.0f }; |
@@ -600,6 +598,24 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
600 | set_Color(tmBannerTitle_ColorId, get_Color(white_ColorId)); | 598 | set_Color(tmBannerTitle_ColorId, get_Color(white_ColorId)); |
601 | set_Color(tmBannerIcon_ColorId, get_Color(orange_ColorId)); | 599 | set_Color(tmBannerIcon_ColorId, get_Color(orange_ColorId)); |
602 | set_Color(tmInlineContentMetadata_ColorId, get_Color(cyan_ColorId)); | 600 | set_Color(tmInlineContentMetadata_ColorId, get_Color(cyan_ColorId)); |
601 | set_Color(tmLinkText_ColorId, get_Color(white_ColorId)); | ||
602 | set_Color(tmLinkIcon_ColorId, get_Color(cyan_ColorId)); | ||
603 | set_Color(tmLinkTextHover_ColorId, get_Color(cyan_ColorId)); | ||
604 | set_Color(tmLinkIconVisited_ColorId, get_Color(teal_ColorId)); | ||
605 | set_Color(tmLinkDomain_ColorId, get_Color(teal_ColorId)); | ||
606 | set_Color(tmLinkLastVisitDate_ColorId, get_Color(cyan_ColorId)); | ||
607 | set_Color(tmHypertextLinkText_ColorId, get_Color(white_ColorId)); | ||
608 | set_Color(tmHypertextLinkIcon_ColorId, get_Color(orange_ColorId)); | ||
609 | set_Color(tmHypertextLinkTextHover_ColorId, get_Color(orange_ColorId)); | ||
610 | set_Color(tmHypertextLinkIconVisited_ColorId, get_Color(brown_ColorId)); | ||
611 | set_Color(tmHypertextLinkDomain_ColorId, get_Color(brown_ColorId)); | ||
612 | set_Color(tmHypertextLinkLastVisitDate_ColorId, get_Color(orange_ColorId)); | ||
613 | set_Color(tmGopherLinkText_ColorId, get_Color(white_ColorId)); | ||
614 | set_Color(tmGopherLinkIcon_ColorId, get_Color(blue_ColorId)); | ||
615 | set_Color(tmGopherLinkTextHover_ColorId, get_Color(blue_ColorId)); | ||
616 | set_Color(tmGopherLinkIconVisited_ColorId, get_Color(magenta_ColorId)); | ||
617 | set_Color(tmGopherLinkDomain_ColorId, get_Color(magenta_ColorId)); | ||
618 | set_Color(tmGopherLinkLastVisitDate_ColorId, get_Color(blue_ColorId)); | ||
603 | } | 619 | } |
604 | else { | 620 | else { |
605 | const iHSLColor base = { 0, 0, 1.0f, 1.0f }; | 621 | const iHSLColor base = { 0, 0, 1.0f, 1.0f }; |
@@ -615,162 +631,164 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
615 | set_Color(tmBannerTitle_ColorId, get_Color(gray50_ColorId)); | 631 | set_Color(tmBannerTitle_ColorId, get_Color(gray50_ColorId)); |
616 | set_Color(tmBannerIcon_ColorId, get_Color(teal_ColorId)); | 632 | set_Color(tmBannerIcon_ColorId, get_Color(teal_ColorId)); |
617 | set_Color(tmInlineContentMetadata_ColorId, get_Color(brown_ColorId)); | 633 | set_Color(tmInlineContentMetadata_ColorId, get_Color(brown_ColorId)); |
634 | |||
635 | set_Color(tmLinkText_ColorId, get_Color(black_ColorId)); | ||
636 | set_Color(tmLinkIcon_ColorId, get_Color(teal_ColorId)); | ||
637 | set_Color(tmLinkTextHover_ColorId, get_Color(teal_ColorId)); | ||
638 | set_Color(tmLinkIconVisited_ColorId, get_Color(cyan_ColorId)); | ||
639 | set_Color(tmLinkDomain_ColorId, get_Color(cyan_ColorId)); | ||
640 | set_Color(tmLinkLastVisitDate_ColorId, get_Color(teal_ColorId)); | ||
641 | set_Color(tmHypertextLinkText_ColorId, get_Color(black_ColorId)); | ||
642 | set_Color(tmHypertextLinkIcon_ColorId, get_Color(brown_ColorId)); | ||
643 | set_Color(tmHypertextLinkTextHover_ColorId, get_Color(brown_ColorId)); | ||
644 | set_Color(tmHypertextLinkIconVisited_ColorId, get_Color(orange_ColorId)); | ||
645 | set_Color(tmHypertextLinkDomain_ColorId, get_Color(orange_ColorId)); | ||
646 | set_Color(tmHypertextLinkLastVisitDate_ColorId, get_Color(brown_ColorId)); | ||
647 | set_Color(tmGopherLinkText_ColorId, get_Color(black_ColorId)); | ||
648 | set_Color(tmGopherLinkIcon_ColorId, get_Color(blue_ColorId)); | ||
649 | set_Color(tmGopherLinkTextHover_ColorId, get_Color(blue_ColorId)); | ||
650 | set_Color(tmGopherLinkIconVisited_ColorId, get_Color(magenta_ColorId)); | ||
651 | set_Color(tmGopherLinkDomain_ColorId, get_Color(magenta_ColorId)); | ||
652 | set_Color(tmGopherLinkLastVisitDate_ColorId, get_Color(blue_ColorId)); | ||
618 | } | 653 | } |
619 | set_Color(tmBadLink_ColorId, get_Color(red_ColorId)); | 654 | set_Color(tmBadLink_ColorId, get_Color(red_ColorId)); |
620 | set_Color(tmLinkText_ColorId, get_Color(white_ColorId)); | ||
621 | set_Color(tmLinkIcon_ColorId, get_Color(cyan_ColorId)); | ||
622 | set_Color(tmLinkTextHover_ColorId, get_Color(cyan_ColorId)); | ||
623 | set_Color(tmLinkIconVisited_ColorId, get_Color(teal_ColorId)); | ||
624 | set_Color(tmLinkDomain_ColorId, get_Color(teal_ColorId)); | ||
625 | set_Color(tmLinkLastVisitDate_ColorId, get_Color(cyan_ColorId)); | ||
626 | set_Color(tmHypertextLinkText_ColorId, get_Color(white_ColorId)); | ||
627 | set_Color(tmHypertextLinkIcon_ColorId, get_Color(orange_ColorId)); | ||
628 | set_Color(tmHypertextLinkTextHover_ColorId, get_Color(orange_ColorId)); | ||
629 | set_Color(tmHypertextLinkIconVisited_ColorId, get_Color(brown_ColorId)); | ||
630 | set_Color(tmHypertextLinkDomain_ColorId, get_Color(brown_ColorId)); | ||
631 | set_Color(tmHypertextLinkLastVisitDate_ColorId, get_Color(orange_ColorId)); | ||
632 | set_Color(tmGopherLinkText_ColorId, get_Color(white_ColorId)); | ||
633 | set_Color(tmGopherLinkIcon_ColorId, get_Color(blue_ColorId)); | ||
634 | set_Color(tmGopherLinkTextHover_ColorId, get_Color(blue_ColorId)); | ||
635 | set_Color(tmGopherLinkIconVisited_ColorId, get_Color(magenta_ColorId)); | ||
636 | set_Color(tmGopherLinkDomain_ColorId, get_Color(magenta_ColorId)); | ||
637 | set_Color(tmGopherLinkLastVisitDate_ColorId, get_Color(blue_ColorId)); | ||
638 | } | 655 | } |
639 | if (seed && !isEmpty_Block(seed)) { | 656 | if (seed && !isEmpty_Block(seed)) { |
640 | d->themeSeed = crc32_Block(seed); | 657 | d->themeSeed = crc32_Block(seed); |
641 | d->siteIcon = siteIcons[(d->themeSeed >> 7) % iElemCount(siteIcons)]; | 658 | d->siteIcon = siteIcons[(d->themeSeed >> 7) % iElemCount(siteIcons)]; |
642 | /* Set up colors. */ { | 659 | } |
643 | static const float hues[] = { 5, 25, 40, 56, 80, 120, 160, 180, 208, 231, 270, 324 }; | 660 | else { |
644 | static const struct { | 661 | d->themeSeed = 0; |
645 | int index[2]; | 662 | d->siteIcon = 0x1f310; /* globe */ |
646 | } altHues[iElemCount(hues)] = { | 663 | } |
647 | { 2, 4 }, /* red */ | 664 | /* Set up colors. */ |
648 | { 8, 3 }, /* reddish orange */ | 665 | if (d->themeSeed) { |
649 | { 7, 9 }, /* yellowish orange */ | 666 | static const float hues[] = { 5, 25, 40, 56, 80, 120, 160, 180, 208, 231, 270, 324 }; |
650 | { 5, 7 }, /* yellow */ | 667 | static const struct { |
651 | { 11, 2 }, /* greenish yellow */ | 668 | int index[2]; |
652 | { 1, 3 }, /* green */ | 669 | } altHues[iElemCount(hues)] = { |
653 | { 2, 4 }, /* bluish green */ | 670 | { 2, 4 }, /* red */ |
654 | { 2, 11 }, /* cyan */ | 671 | { 8, 3 }, /* reddish orange */ |
655 | { 6, 10 }, /* sky blue */ | 672 | { 7, 9 }, /* yellowish orange */ |
656 | { 3, 11 }, /* blue */ | 673 | { 5, 7 }, /* yellow */ |
657 | { 8, 9 }, /* violet */ | 674 | { 11, 2 }, /* greenish yellow */ |
658 | { 7, 8 }, /* pink */ | 675 | { 1, 3 }, /* green */ |
659 | }; | 676 | { 2, 4 }, /* bluish green */ |
660 | const float saturationLevel = 1.0f; /* TODO: user setting */ | 677 | { 2, 11 }, /* cyan */ |
661 | const iBool isBannerLighter = (d->themeSeed & 0x4000) != 0; | 678 | { 6, 10 }, /* sky blue */ |
662 | const size_t primIndex = (d->themeSeed & 0xff) % iElemCount(hues); | 679 | { 3, 11 }, /* blue */ |
663 | const iBool isDarkBgSat = | 680 | { 8, 9 }, /* violet */ |
664 | (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); | 681 | { 7, 8 }, /* pink */ |
665 | iHSLColor base = { hues[primIndex], | 682 | }; |
666 | 0.8f * (d->themeSeed >> 24) / 255.0f, | 683 | const float saturationLevel = 1.0f; /* TODO: user setting */ |
667 | 0.06f + 0.09f * ((d->themeSeed >> 5) & 0x7) / 7.0f, | 684 | const iBool isBannerLighter = (d->themeSeed & 0x4000) != 0; |
668 | 1.0f }; | 685 | const size_t primIndex = d->themeSeed ? (d->themeSeed & 0xff) % iElemCount(hues) : 2; |
669 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); | 686 | const iBool isDarkBgSat = |
670 | // printf("isDarkBgSat: %d\n", isDarkBgSat); | 687 | (d->themeSeed & 0x200000) != 0 && (primIndex < 1 || primIndex > 4); |
671 | setHsl_Color(tmBackground_ColorId, base); | 688 | iHSLColor base = { hues[primIndex], |
672 | 689 | 0.8f * (d->themeSeed >> 24) / 255.0f, | |
673 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0.1f, 0.04f * (isBannerLighter ? 1 : -1))); | 690 | 0.06f + 0.09f * ((d->themeSeed >> 5) & 0x7) / 7.0f, |
674 | setHsl_Color(tmBannerTitle_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.1f, 0), 0.55f)); | 691 | 1.0f }; |
675 | setHsl_Color(tmBannerIcon_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.35f, 0), 0.65f)); | 692 | // printf("background: %d %f %f\n", (int) base.hue, base.sat, base.lum); |
676 | 693 | // printf("isDarkBgSat: %d\n", isDarkBgSat); | |
677 | const int altIndex[2] = { (d->themeSeed & 0x4) != 0, | 694 | setHsl_Color(tmBackground_ColorId, base); |
678 | (d->themeSeed & 0x40) != 0 }; | 695 | |
696 | setHsl_Color(tmBannerBackground_ColorId, addSatLum_HSLColor(base, 0.1f, 0.04f * (isBannerLighter ? 1 : -1))); | ||
697 | setHsl_Color(tmBannerTitle_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.1f, 0), 0.55f)); | ||
698 | setHsl_Color(tmBannerIcon_ColorId, setLum_HSLColor(addSatLum_HSLColor(base, 0.35f, 0), 0.65f)); | ||
699 | |||
700 | const int altIndex[2] = { (d->themeSeed & 0x4) != 0, | ||
701 | (d->themeSeed & 0x40) != 0 }; | ||
679 | 702 | ||
680 | // printf("primHue: %zu alts: %d %d\n", | 703 | // printf("primHue: %zu alts: %d %d\n", |
681 | // primIndex, | 704 | // primIndex, |
682 | // altHues[primIndex].index[altIndex[0]], | 705 | // altHues[primIndex].index[altIndex[0]], |
683 | // altHues[primIndex].index[altIndex[1]]); | 706 | // altHues[primIndex].index[altIndex[1]]); |
684 | const float altHue = hues[altHues[primIndex].index[altIndex[0]]]; | 707 | const float altHue = hues[d->themeSeed ? altHues[primIndex].index[altIndex[0]] : 8]; |
685 | const float altHue2 = hues[altHues[primIndex].index[altIndex[1]]]; | 708 | const float altHue2 = hues[d->themeSeed ? altHues[primIndex].index[altIndex[1]] : 8]; |
686 | iHSLColor altBase = { altHue, base.sat, base.lum, 1 }; | 709 | iHSLColor altBase = { altHue, base.sat, base.lum, 1 }; |
687 | const float titleLum = 0.2f * ((d->themeSeed >> 17) & 0x7) / 7.0f; | 710 | const float titleLum = 0.2f * ((d->themeSeed >> 17) & 0x7) / 7.0f; |
688 | setHsl_Color(tmHeading1_ColorId, setLum_HSLColor(altBase, titleLum + 0.80f)); | 711 | setHsl_Color(tmHeading1_ColorId, setLum_HSLColor(altBase, titleLum + 0.80f)); |
689 | setHsl_Color(tmHeading2_ColorId, setLum_HSLColor(altBase, titleLum + 0.70f)); | 712 | setHsl_Color(tmHeading2_ColorId, setLum_HSLColor(altBase, titleLum + 0.70f)); |
690 | setHsl_Color(tmHeading3_ColorId, setLum_HSLColor(altBase, titleLum + 0.60f)); | 713 | setHsl_Color(tmHeading3_ColorId, setLum_HSLColor(altBase, titleLum + 0.60f)); |
691 | 714 | ||
692 | setHsl_Color(tmParagraph_ColorId, addSatLum_HSLColor(base, 0.1f, 0.6f)); | 715 | setHsl_Color(tmParagraph_ColorId, addSatLum_HSLColor(base, 0.1f, 0.6f)); |
693 | setHsl_Color(tmFirstParagraph_ColorId, addSatLum_HSLColor(base, 0.2f, 0.8f)); | 716 | setHsl_Color(tmFirstParagraph_ColorId, addSatLum_HSLColor(base, 0.2f, 0.8f)); |
694 | setHsl_Color(tmPreformatted_ColorId, (iHSLColor){ altHue2, 1.0f, 0.75f, 1.0f }); | 717 | setHsl_Color(tmPreformatted_ColorId, (iHSLColor){ altHue2, 1.0f, 0.75f, 1.0f }); |
695 | set_Color(tmQuote_ColorId, get_Color(tmPreformatted_ColorId)); | 718 | set_Color(tmQuote_ColorId, get_Color(tmPreformatted_ColorId)); |
696 | set_Color(tmInlineContentMetadata_ColorId, get_Color(tmHeading3_ColorId)); | 719 | set_Color(tmInlineContentMetadata_ColorId, get_Color(tmHeading3_ColorId)); |
697 | 720 | ||
698 | /* Adjust colors based on light/dark mode. */ | 721 | /* Adjust colors based on light/dark mode. */ |
699 | for (int i = tmFirst_ColorId; i < max_ColorId; i++) { | 722 | for (int i = tmFirst_ColorId; i < max_ColorId; i++) { |
700 | iHSLColor color = hsl_Color(get_Color(i)); | 723 | iHSLColor color = hsl_Color(get_Color(i)); |
701 | if (isLightMode) { | 724 | if (isLightMode) { |
702 | color.lum = 1.0f - color.lum; /* All colors invert lightness. */ | 725 | color.lum = 1.0f - color.lum; /* All colors invert lightness. */ |
703 | if (isRegularText_ColorId(i)) { | 726 | if (isRegularText_ColorId(i)) { |
704 | /* Darken paragraphs and default state link text. */ | 727 | /* Darken paragraphs and default state link text. */ |
705 | color.lum *= 0.5f; | 728 | color.lum *= 0.5f; |
729 | } | ||
730 | else if (i == tmBackground_ColorId) { | ||
731 | color.sat = (color.sat + 1) / 2; | ||
732 | color.lum += 0.06f; | ||
733 | } | ||
734 | else if (i == tmHeading3_ColorId) { | ||
735 | color.lum *= 0.75f; | ||
736 | } | ||
737 | else if (isLink_ColorId(i)) { | ||
738 | /* Darken links generally to improve visibility against a | ||
739 | light background. */ | ||
740 | color.lum *= 0.5f; | ||
741 | color.sat = 1.0f; | ||
742 | } | ||
743 | else if (i == tmBannerIcon_ColorId || i == tmBannerTitle_ColorId) { | ||
744 | if (isBannerLighter) { | ||
745 | color.lum *= 0.75f; | ||
706 | } | 746 | } |
707 | else if (i == tmBackground_ColorId) { | 747 | else { |
708 | color.sat = (color.sat + 1) / 2; | 748 | color.lum = 0.98f; |
709 | color.lum += 0.06f; | ||
710 | } | 749 | } |
711 | else if (i == tmHeading3_ColorId) { | 750 | } |
712 | color.lum *= 0.75f; | 751 | else if (i == tmBannerBackground_ColorId) { |
752 | if (isBannerLighter) { | ||
753 | color.lum = 1.0f; | ||
713 | } | 754 | } |
714 | else if (isLink_ColorId(i)) { | 755 | else { |
715 | /* Darken links generally to improve visibility against a | 756 | color.sat *= 0.8f; |
716 | light background. */ | 757 | color.lum = 0.4f; |
717 | color.lum *= 0.5f; | ||
718 | color.sat = 1.0f; | ||
719 | } | 758 | } |
720 | else if (i == tmBannerIcon_ColorId || i == tmBannerTitle_ColorId) { | 759 | } |
721 | if (isBannerLighter) { | 760 | else if (isText_ColorId(i)) { |
761 | color.sat = 0.9f; | ||
762 | color.lum = (9 * color.lum + 0.5f) / 10; | ||
763 | } | ||
764 | } | ||
765 | else { /* dark mode */ | ||
766 | if (!isLink_ColorId(i)) { | ||
767 | if (isDarkBgSat) { | ||
768 | /* Saturate background, desaturate text. */ | ||
769 | if (isBackground_ColorId(i)) { | ||
770 | color.sat = (color.sat + 1) / 2; | ||
722 | color.lum *= 0.75f; | 771 | color.lum *= 0.75f; |
723 | } | 772 | } |
724 | else { | 773 | else if (isText_ColorId(i)) { |
725 | color.lum = 0.98f; | 774 | color.lum = (color.lum + 1) / 2; |
726 | } | 775 | } |
727 | } | 776 | } |
728 | else if (i == tmBannerBackground_ColorId) { | 777 | else { |
729 | if (isBannerLighter) { | 778 | /* Desaturate background, saturate text. */ |
730 | color.lum = 1.0f; | 779 | if (isBackground_ColorId(i)) { |
731 | } | 780 | color.sat *= 0.333f; |
732 | else { | ||
733 | color.sat *= 0.8f; | ||
734 | color.lum = 0.4f; | ||
735 | } | ||
736 | } | ||
737 | else if (isText_ColorId(i)) { | ||
738 | color.sat = 0.9f; | ||
739 | color.lum = (9 * color.lum + 0.5f) / 10; | ||
740 | } | ||
741 | } | ||
742 | else { /* dark mode */ | ||
743 | if (!isLink_ColorId(i)) { | ||
744 | if (isDarkBgSat) { | ||
745 | /* Saturate background, desaturate text. */ | ||
746 | if (isBackground_ColorId(i)) { | ||
747 | color.sat = (color.sat + 1) / 2; | ||
748 | // color.lum = (color.lum + 2 * 0.5f) / 3; | ||
749 | color.lum *= 0.75f; | ||
750 | } | ||
751 | else if (isText_ColorId(i)) { | ||
752 | // color.sat *= 0.85f; | ||
753 | color.lum = (color.lum + 1) / 2; | ||
754 | } | ||
755 | } | 781 | } |
756 | else { | 782 | else if (isText_ColorId(i)) { |
757 | /* Desaturate background, saturate text. */ | 783 | color.sat = (color.sat + 2) / 3; |
758 | if (isBackground_ColorId(i)) { | 784 | color.lum = (2 * color.lum + 1) / 3; |
759 | color.sat *= 0.333f; | ||
760 | // color.lum *= 0.5f; | ||
761 | } | ||
762 | else if (isText_ColorId(i)) { | ||
763 | color.sat = (color.sat + 2) / 3; | ||
764 | color.lum = (2 * color.lum + 1) / 3; | ||
765 | // color.lum = (color.lum + 0.5f) / 2; | ||
766 | } | ||
767 | } | 785 | } |
768 | } | 786 | } |
769 | } | 787 | } |
770 | /* Modify overall saturation. */ | ||
771 | color.sat *= saturationLevel; | ||
772 | setHsl_Color(i, color); | ||
773 | } | 788 | } |
789 | /* Modify overall saturation. */ | ||
790 | color.sat *= saturationLevel; | ||
791 | setHsl_Color(i, color); | ||
774 | } | 792 | } |
775 | } | 793 | } |
776 | /* Special exceptions. */ | 794 | /* Special exceptions. */ |
@@ -779,7 +797,6 @@ void setThemeSeed_GmDocument(iGmDocument *d, const iBlock *seed) { | |||
779 | d->siteIcon = 0x264a; /* gemini symbol */ | 797 | d->siteIcon = 0x264a; /* gemini symbol */ |
780 | } | 798 | } |
781 | } | 799 | } |
782 | fflush(stdout); | ||
783 | } | 800 | } |
784 | 801 | ||
785 | void setFormat_GmDocument(iGmDocument *d, enum iGmDocumentFormat format) { | 802 | void setFormat_GmDocument(iGmDocument *d, enum iGmDocumentFormat format) { |
diff --git a/src/ui/color.c b/src/ui/color.c index b9470084..27d613cc 100644 --- a/src/ui/color.c +++ b/src/ui/color.c | |||
@@ -89,6 +89,8 @@ void setThemePalette_Color(enum iColorTheme theme) { | |||
89 | copy_(uiHeading_ColorId, cyan_ColorId); | 89 | copy_(uiHeading_ColorId, cyan_ColorId); |
90 | copy_(uiIcon_ColorId, cyan_ColorId); | 90 | copy_(uiIcon_ColorId, cyan_ColorId); |
91 | copy_(uiSeparator_ColorId, black_ColorId); | 91 | copy_(uiSeparator_ColorId, black_ColorId); |
92 | copy_(uiMarked_ColorId, brown_ColorId); | ||
93 | copy_(uiMatching_ColorId, teal_ColorId); | ||
92 | break; | 94 | break; |
93 | case light_ColorTheme: | 95 | case light_ColorTheme: |
94 | copy_(uiBackground_ColorId, white_ColorId); | 96 | copy_(uiBackground_ColorId, white_ColorId); |
@@ -128,6 +130,8 @@ void setThemePalette_Color(enum iColorTheme theme) { | |||
128 | copy_(uiHeading_ColorId, brown_ColorId); | 130 | copy_(uiHeading_ColorId, brown_ColorId); |
129 | copy_(uiIcon_ColorId, brown_ColorId); | 131 | copy_(uiIcon_ColorId, brown_ColorId); |
130 | copy_(uiSeparator_ColorId, gray50_ColorId); | 132 | copy_(uiSeparator_ColorId, gray50_ColorId); |
133 | copy_(uiMarked_ColorId, cyan_ColorId); | ||
134 | copy_(uiMatching_ColorId, orange_ColorId); | ||
131 | break; | 135 | break; |
132 | } | 136 | } |
133 | } | 137 | } |
diff --git a/src/ui/color.h b/src/ui/color.h index 77cbac09..a359e09e 100644 --- a/src/ui/color.h +++ b/src/ui/color.h | |||
@@ -66,6 +66,8 @@ enum iColorId { | |||
66 | uiHeading_ColorId, | 66 | uiHeading_ColorId, |
67 | uiIcon_ColorId, | 67 | uiIcon_ColorId, |
68 | uiSeparator_ColorId, | 68 | uiSeparator_ColorId, |
69 | uiMarked_ColorId, | ||
70 | uiMatching_ColorId, | ||
69 | 71 | ||
70 | /* content theme colors */ | 72 | /* content theme colors */ |
71 | tmFirst_ColorId, | 73 | tmFirst_ColorId, |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index ae828367..eb126a0f 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -864,8 +864,9 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
864 | refresh_Widget(w); | 864 | refresh_Widget(w); |
865 | updateWindowTitle_DocumentWidget_(d); | 865 | updateWindowTitle_DocumentWidget_(d); |
866 | } | 866 | } |
867 | else if (equal_Command(cmd, "theme.changed")) { | 867 | else if (equal_Command(cmd, "theme.changed") && document_App() == d) { |
868 | updateTheme_DocumentWidget_(d); | 868 | updateTheme_DocumentWidget_(d); |
869 | refresh_Widget(w); | ||
869 | } | 870 | } |
870 | else if (equal_Command(cmd, "tabs.changed")) { | 871 | else if (equal_Command(cmd, "tabs.changed")) { |
871 | if (cmp_String(id_Widget(w), suffixPtr_Command(cmd, "id")) == 0) { | 872 | if (cmp_String(id_Widget(w), suffixPtr_Command(cmd, "id")) == 0) { |
@@ -1291,8 +1292,8 @@ static void drawRun_DrawContext_(void *context, const iGmRun *run) { | |||
1291 | const iInt2 visPos = add_I2(run->visBounds.pos, origin); | 1292 | const iInt2 visPos = add_I2(run->visBounds.pos, origin); |
1292 | /* Text markers. */ | 1293 | /* Text markers. */ |
1293 | /* TODO: Add themed palette entries */ | 1294 | /* TODO: Add themed palette entries */ |
1294 | fillRange_DrawContext_(d, run, teal_ColorId, d->widget->foundMark, &d->inFoundMark); | 1295 | fillRange_DrawContext_(d, run, uiMatching_ColorId, d->widget->foundMark, &d->inFoundMark); |
1295 | fillRange_DrawContext_(d, run, brown_ColorId, d->widget->selectMark, &d->inSelectMark); | 1296 | fillRange_DrawContext_(d, run, uiMarked_ColorId, d->widget->selectMark, &d->inSelectMark); |
1296 | if (run->linkId && !isEmpty_Rect(run->bounds)) { | 1297 | if (run->linkId && !isEmpty_Rect(run->bounds)) { |
1297 | fg = linkColor_GmDocument(doc, run->linkId, isHover ? textHover_GmLinkPart : text_GmLinkPart); | 1298 | fg = linkColor_GmDocument(doc, run->linkId, isHover ? textHover_GmLinkPart : text_GmLinkPart); |
1298 | if (linkFlags_GmDocument(doc, run->linkId) & content_GmLinkFlag) { | 1299 | if (linkFlags_GmDocument(doc, run->linkId) & content_GmLinkFlag) { |