question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dark/Light Accent colors not working?

See original GitHub issue

Accent Color is working, but Dark/Light Accent colors not working. it still seems to follow Windows.

<StackPanel Padding="32">
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColorLight3}"/>
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColorLight2}"/>
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColorLight1}"/>
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColor}"/>
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColorDark1}"/>
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColorDark2}"/>
    <Rectangle Width="100" Height="100" Fill="{ThemeResource SystemAccentColorDark3}"/>
</StackPanel>

image

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <ResourceDictionary.MergedDictionaries>
            <ColorPaletteResources Accent="#FF22D7BB" AltHigh="#FF000000" AltLow="#FF000000" AltMedium="#FF000000" AltMediumHigh="#FF000000" AltMediumLow="#FF000000" BaseHigh="#FFFFFFFF" BaseLow="#FF333333" BaseMedium="#FF9A9A9A" BaseMediumHigh="#FFB4B4B4" BaseMediumLow="#FF676767" ChromeAltLow="#FFB4B4B4" ChromeBlackHigh="#FF000000" ChromeBlackLow="#FFB4B4B4" ChromeBlackMedium="#FF000000" ChromeBlackMediumLow="#FF000000" ChromeDisabledHigh="#FF333333" ChromeDisabledLow="#FF9A9A9A" ChromeGray="#FF808080" ChromeHigh="#FF808080" ChromeLow="#FF151515" ChromeMedium="#FF1D1D1D" ChromeMediumLow="#FF2C2C2C" ChromeWhite="#FFFFFFFF" ListLow="#FF1D1D1D" ListMedium="#FF333333" />
            <ResourceDictionary>
                <Color x:Key="SystemChromeAltMediumHighColor">#CC000000</Color>
                <Color x:Key="SystemChromeAltHighColor">#FF000000</Color>
                <Color x:Key="SystemRevealListLowColor">#FF1D1D1D</Color>
                <Color x:Key="SystemRevealListMediumColor">#FF333333</Color>
                <Color x:Key="RegionColor">#FF000000</Color>
                <SolidColorBrush x:Key="RegionBrush" Color="{StaticResource RegionColor}" />
            </ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    <ResourceDictionary x:Key="Light">
        <ResourceDictionary.MergedDictionaries>
            <ColorPaletteResources Accent="#FF22D7BB" AltHigh="#FFFFFFFF" AltLow="#FFFFFFFF" AltMedium="#FFFFFFFF" AltMediumHigh="#FFFFFFFF" AltMediumLow="#FFFFFFFF" BaseHigh="#FF000000" BaseLow="#FFCCCCCC" BaseMedium="#FF898989" BaseMediumHigh="#FF5D5D5D" BaseMediumLow="#FF737373" ChromeAltLow="#FF5D5D5D" ChromeBlackHigh="#FF000000" ChromeBlackLow="#FFCCCCCC" ChromeBlackMedium="#FF5D5D5D" ChromeBlackMediumLow="#FF898989" ChromeDisabledHigh="#FFCCCCCC" ChromeDisabledLow="#FF898989" ChromeGray="#FF737373" ChromeHigh="#FFCCCCCC" ChromeLow="#FFECECEC" ChromeMedium="#FFE6E6E6" ChromeMediumLow="#FFECECEC" ChromeWhite="#FFFFFFFF" ListLow="#FFE6E6E6" ListMedium="#FFCCCCCC" />
            <ResourceDictionary>
                <Color x:Key="SystemChromeAltMediumHighColor">#CCFFFFFF</Color>
                <Color x:Key="SystemChromeAltHighColor">#FFFFFFFF</Color>
                <Color x:Key="SystemRevealListLowColor">#FFE6E6E6</Color>
                <Color x:Key="SystemRevealListMediumColor">#FFCCCCCC</Color>
                <RevealBackgroundBrush x:Key="SystemControlHighlightListLowRevealBackgroundBrush" TargetTheme="Light" Color="{ThemeResource SystemRevealListMediumColor}" FallbackColor="{ StaticResource SystemListMediumColor}" />
                <Color x:Key="RegionColor">#FFFFFFFF</Color>
                <SolidColorBrush x:Key="RegionBrush" Color="{StaticResource RegionColor}" />
            </ResourceDictionary>
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    <ResourceDictionary x:Key="HighContrast">
        <StaticResource x:Key="RegionColor" ResourceKey="SystemColorWindowColor" />
        <SolidColorBrush x:Key="RegionBrush" Color="{StaticResource RegionColor}" />
    </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kikisaintscommented, Mar 26, 2019

So due to the fact that the Light1,2,3 Dark1,2,3 are being overwritten in the generated code, you’ll have to manually set them:

private void ChangeTheme()
{
    ColorPaletteResources def = FindColorPaletteResourcesForTheme("Default");
    def.Accent = Color.FromArgb(255, 111, 118, 250);

    //Grab color from the Application's resources
    Color myColor = (Color)Application.Current.Resources["SystemAccentColorDark1"];
    //Manually set new color
    myColor = Color.FromARGB(255, 89, 101, 229);
    //Apply new color to Application's resources
    Application.Current.Resources["SystemAccentColorDark1"] = myColor;

   //Reload the theme
    ReloadPageTheme(RequestedTheme);
}

As far as know what color to set them in order to get the right shades, you’ll have to just run your new accent color through the Theme Editor and select the values you want.

For instance, if you want your new accent color to be RGB = 111, 118, 250. Plug that into the Editor: image

Let the color algorithm determine your pallete, and pull the values you want from there into your “ChangeTheme” function: image (Order is should be reversed for Primary Dark Theme palette).

0reactions
doghappycommented, Mar 27, 2019

Nice!!! Thank you very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't change accent colors in any mode (Dark/Light)
Title: Can't change accent colors in any mode (Dark/Light)Device: OnePlus 3Software Version: Openbeta ... Try changing the accent colors it will not change....
Read more >
Win11: 22H2. Custom "Manual" accent colors broken ...
The first thing I noticed is no matter what I do, I can't change the accent color to the "Manual" custom color I...
Read more >
GBoard not applying dark/light theme automatically
I changed the accent color to green and really disliked the green Gboard theme that goes with it. How the light/dark switch is...
Read more >
Change colour of File Explorer title bar?
I tried to get the accent color on the File Explorer title bar without using a theme, but it doesn't work properly eventhough...
Read more >
[Theme][Tweaks] Accents for Android O [Dark][Light][+150 ...
Hey guys, i pushed new update for Pixel accent, now its called Accents for O, i added more accent colors, navbar tint, systemui...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found