[haiku-commits] Change in haiku[master]: AboutSystem: Respect system colors

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 22 Sep 2020 18:35:28 +0000

From Adrien Destugues <pulkomandy@xxxxxxxxx>:

Adrien Destugues has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3262 ;)


Change subject: AboutSystem: Respect system colors
......................................................................

AboutSystem: Respect system colors
---
M src/apps/aboutsystem/AboutSystem.cpp
1 file changed, 58 insertions(+), 42 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/62/3262/1

diff --git a/src/apps/aboutsystem/AboutSystem.cpp 
b/src/apps/aboutsystem/AboutSystem.cpp
index a12279e..5e719d6 100644
--- a/src/apps/aboutsystem/AboutSystem.cpp
+++ b/src/apps/aboutsystem/AboutSystem.cpp
@@ -84,13 +84,11 @@
        system_info* info);


-static const rgb_color kDarkGrey = { 100, 100, 100, 255 };
-static const rgb_color kHaikuGreen = { 42, 131, 36, 255 };
-static const rgb_color kHaikuOrange = { 255, 69, 0, 255 };
-static const rgb_color kHaikuYellow = { 255, 176, 0, 255 };
-static const rgb_color kLinkBlue = { 80, 80, 200, 255 };
-static const rgb_color kBeOSBlue = { 0, 0, 200, 255 };
-static const rgb_color kBeOSRed = { 200, 0, 0, 255 };
+static const rgb_color kIdealHaikuGreen = { 42, 131, 36, 255 };
+static const rgb_color kIdealHaikuOrange = { 255, 69, 0, 255 };
+static const rgb_color kIdealHaikuYellow = { 255, 176, 0, 255 };
+static const rgb_color kIdealBeOSBlue = { 0, 0, 200, 255 };
+static const rgb_color kIdealBeOSRed = { 200, 0, 0, 255 };

 static const char* kBSDTwoClause = B_TRANSLATE_MARK("BSD (2-clause)");
 static const char* kBSDThreeClause = B_TRANSLATE_MARK("BSD (3-clause)");
@@ -241,6 +239,15 @@
                        bigtime_t               fLastActionTime;
                        BMessageRunner* fScrollRunner;
                        PackageCreditMap fPackageCredits;
+
+private:
+                       rgb_color               fTextColor;
+                       rgb_color               fLinkColor;
+                       rgb_color               fHaikuOrangeColor;
+                       rgb_color               fHaikuGreenColor;
+                       rgb_color               fHaikuYellowColor;
+                       rgb_color               fBeOSRedColor;
+                       rgb_color               fBeOSBlueColor;
 };


@@ -423,6 +430,15 @@
        fLastActionTime(system_time()),
        fScrollRunner(NULL)
 {
+       // Assign the colors, sadly this does not respect live color updates
+       fTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
+       fLinkColor = ui_color(B_LINK_TEXT_COLOR);
+       fHaikuOrangeColor = mix_color(fTextColor, kIdealHaikuOrange, 191);
+       fHaikuGreenColor = mix_color(fTextColor, kIdealHaikuGreen, 191);
+       fHaikuYellowColor = mix_color(fTextColor, kIdealHaikuYellow, 191);
+       fBeOSRedColor = mix_color(fTextColor, kIdealBeOSRed, 191);
+       fBeOSBlueColor = mix_color(fTextColor, kIdealBeOSBlue, 191);
+
        // Begin Construction of System Information controls
        system_info systemInfo;
        get_system_info(&systemInfo);
@@ -724,10 +740,10 @@
        //font.SetSize(be_bold_font->Size());
        font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuYellow);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuYellowColor);
        fCreditsView->Insert(name);
        fCreditsView->Insert("\n");
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(text);
        fCreditsView->Insert("\n");

@@ -772,7 +788,7 @@
                        parse_named_url(source, urlName, urlAddress);

                        fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL,
-                               &kLinkBlue);
+                               &fLinkColor);
                        fCreditsView->InsertHyperText(urlName,
                                new URLAction(urlAddress));
                }
@@ -786,7 +802,7 @@
                parse_named_url(url, urlName, urlAddress);

                fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL,
-                       &kLinkBlue);
+                       &fLinkColor);
                fCreditsView->InsertHyperText(urlName,
                        new URLAction(urlAddress));
                fCreditsView->Insert("\n");
@@ -839,7 +855,7 @@
        font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);
        fCreditsView->SelectAll();
        fCreditsView->Delete();
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(s->String());
        fCreditsView->Insert("\n");
        while ((s = (BString*)haikuList.RemoveItem((int32)0))) {
@@ -902,7 +918,7 @@
        BFont font(be_bold_font);
        font.SetSize(font.Size() + 4);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuGreenColor);
        fCreditsView->Insert("Haiku\n");

        char string[1024];
@@ -915,10 +931,10 @@
                B_TRANSLATE(COPYRIGHT_STRING "2001-%" B_PRId32 " The Haiku 
project. "),
                year);

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(string);

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(B_TRANSLATE("The copyright to the Haiku code is "
                "property of Haiku, Inc. or of the respective authors where 
expressly "
                "noted in the source. Haiku" B_UTF8_REGISTERED
@@ -926,7 +942,7 @@
                " are registered trademarks of Haiku, Inc."
                "\n\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fLinkColor);
        fCreditsView->InsertHyperText("https://www.haiku-os.org";,
                new URLAction("https://www.haiku-os.org";));
        fCreditsView->Insert("\n\n");
@@ -934,47 +950,47 @@
        font.SetSize(be_bold_font->Size());
        font.SetFace(B_BOLD_FACE | B_ITALIC_FACE);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Current maintainers:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kCurrentMaintainers);
 
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Past maintainers:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kPastMaintainers);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Website & marketing:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kWebsiteTeam);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Past website & marketing:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kPastWebsiteTeam);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Testing and bug triaging:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kTestingTeam);

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Contributors:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(kContributors);
        fCreditsView->Insert(
                B_TRANSLATE("\n" B_UTF8_ELLIPSIS
                        "and probably some more we forgot to mention (sorry!)"
                        "\n\n"));

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("Translations:\n"));

        BLanguage* lang;
@@ -1002,29 +1018,29 @@
                        langName.Append(translation.languageCode);
                }

-               fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+               fCreditsView->SetFontAndColor(&font, B_FONT_ALL, 
&fHaikuGreenColor);
                fCreditsView->Insert("\n");
                fCreditsView->Insert(langName);
                fCreditsView->Insert("\n");
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kDarkGrey);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fTextColor);
                fCreditsView->Insert(translation.names);
        }

-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuOrangeColor);
        fCreditsView->Insert(B_TRANSLATE("\n\nSpecial thanks to:\n"));

-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        BString beosCredits(B_TRANSLATE(
                "Be Inc. and its developer team, for having created 
BeOS!\n\n"));
        int32 beosOffset = beosCredits.FindFirst("BeOS");
        fCreditsView->Insert(beosCredits.String(),
                (beosOffset < 0) ? beosCredits.Length() : beosOffset);
        if (beosOffset > -1) {
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kBeOSBlue);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fBeOSBlueColor);
                fCreditsView->Insert("B");
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kBeOSRed);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fBeOSRedColor);
                fCreditsView->Insert("e");
-               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&kDarkGrey);
+               fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, 
&fTextColor);
                beosCredits.Remove(0, beosOffset + 2);
                fCreditsView->Insert(beosCredits.String(), 
beosCredits.Length());
        }
@@ -1055,7 +1071,7 @@

        font.SetSize(be_bold_font->Size() + 4);
        font.SetFace(B_BOLD_FACE);
-       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen);
+       fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &fHaikuGreenColor);
        fCreditsView->Insert(B_TRANSLATE("\nCopyrights\n\n"));


@@ -1074,31 +1090,31 @@
        int32 licensePart4 = haikuLicense.FindLast(">");
        BString part;
        haikuLicense.CopyInto(part, 0, licensePart1);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(part);

        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart1 + 1, licensePart2 - 1
                - licensePart1);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fLinkColor);
        fCreditsView->InsertHyperText(part, new OpenFileAction(mitPath.Path()));

        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart2 + 1, licensePart3 - 1
                - licensePart2);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(part);

        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart3 + 1, licensePart4 - 1
                - licensePart3);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fLinkColor);
        fCreditsView->InsertHyperText(part, new 
OpenFileAction(lgplPath.Path()));

        part.Truncate(0);
        haikuLicense.CopyInto(part, licensePart4 + 1, haikuLicense.Length() - 1
                - licensePart4);
-       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey);
+       fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &fTextColor);
        fCreditsView->Insert(part);

        // GNU copyrights

--
To view, visit https://review.haiku-os.org/c/haiku/+/3262
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I2fac8c2a7ab9033cc730db373710a856a8827eb8
Gerrit-Change-Number: 3262
Gerrit-PatchSet: 1
Gerrit-Owner: Adrien Destugues <pulkomandy@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: AboutSystem: Respect system colors - Gerrit