Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Accent Colour Brushes to System APIs #3909

Merged
merged 4 commits into from
Jan 9, 2021

Conversation

karkarl
Copy link
Contributor

@karkarl karkarl commented Jan 8, 2021

Description

  • Update Accent Colour Brushes to System APIs
  • Remove colour animations in RadioButtons and Slider that uses these Accent Color Brushes

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Jan 8, 2021
@karkarl
Copy link
Contributor Author

karkarl commented Jan 8, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mdtauk
Copy link
Contributor

mdtauk commented Jan 8, 2021

Aren't the Accent Shades/Tones exposed as colours rather than brushes?

You can animate colours, but not brushes.

Is there a reason why the colour transitions are being removed?

https://docs.microsoft.com/en-us/windows/uwp/design/style/color#accent-color-palette

@ranjeshj ranjeshj requested review from stmoy and YuliKl and removed request for YuliKl and ranjeshj January 8, 2021 22:08
@ranjeshj
Copy link
Contributor

ranjeshj commented Jan 8, 2021

Aren't the Accent Shades/Tones exposed as colours rather than brushes?

You can animate colours, but not brushes.

Is there a reason why the colour transitions are being removed?

https://docs.microsoft.com/en-us/windows/uwp/design/style/color#accent-color-palette

I assume the issue is because we get system brushes but not colors ? @stmoy @YuliKl This is unfortunate. Do we have colors we could use instead ?

@ranjeshj ranjeshj added area-Styling team-Controls Issue for the Controls team and removed needs-triage Issue needs to be triaged by the area owners labels Jan 8, 2021
@mdtauk
Copy link
Contributor

mdtauk commented Jan 8, 2021

Aren't the Accent Shades/Tones exposed as colours rather than brushes?
You can animate colours, but not brushes.
Is there a reason why the colour transitions are being removed?
https://docs.microsoft.com/en-us/windows/uwp/design/style/color#accent-color-palette

I assume the issue is because we get system brushes but not colors ? @stmoy @YuliKl This is unfortunate. Do we have colors we could use instead ?

The documentation page mentions
You can also access the accent color palette programmatically with the UISettings.GetColorValue method and UIColorType enum.

Also the XAML example shows the value being assigned as a Color to a SolidColorBrush

<Page.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="ButtonBackground" Color="{ThemeResource SystemAccentColor}"/>
                <SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{ThemeResource SystemAccentColorLight1}"/>
                <SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{ThemeResource SystemAccentColorDark1}"/>
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Page.Resources>

<Button Content="Button"></Button>

@karkarl
Copy link
Contributor Author

karkarl commented Jan 9, 2021

Aren't the Accent Shades/Tones exposed as colours rather than brushes?
You can animate colours, but not brushes.
Is there a reason why the colour transitions are being removed?
https://docs.microsoft.com/en-us/windows/uwp/design/style/color#accent-color-palette

I assume the issue is because we get system brushes but not colors ? @stmoy @YuliKl This is unfortunate. Do we have colors we could use instead ?

The documentation page mentions
You can also access the accent color palette programmatically with the UISettings.GetColorValue method and UIColorType enum.

Also the XAML example shows the value being assigned as a Color to a SolidColorBrush

<Page.Resources>
    <ResourceDictionary>
        <ResourceDictionary.ThemeDictionaries>
            <ResourceDictionary x:Key="Light">
                <SolidColorBrush x:Key="ButtonBackground" Color="{ThemeResource SystemAccentColor}"/>
                <SolidColorBrush x:Key="ButtonBackgroundPointerOver" Color="{ThemeResource SystemAccentColorLight1}"/>
                <SolidColorBrush x:Key="ButtonBackgroundPressed" Color="{ThemeResource SystemAccentColorDark1}"/>
            </ResourceDictionary>
        </ResourceDictionary.ThemeDictionaries>
    </ResourceDictionary>
</Page.Resources>

<Button Content="Button"></Button>

@mdtauk The resource is a Brush, and when accessed through ColorAnimation's TargetProperty="(Panel.Background).(SolidColorBrush.Color)" it becomes buggy and simply disappears. :(

@mdtauk
Copy link
Contributor

mdtauk commented Jan 9, 2021

Maybe this is something WinUI 3 can fix in the future.

@ranjeshj ranjeshj requested a review from teaP January 9, 2021 00:57
@stmoy
Copy link
Contributor

stmoy commented Jan 9, 2021

The resource is a Brush, and when accessed through ColorAnimation's TargetProperty="(Panel.Background).(SolidColorBrush.Color)" it becomes buggy and simply disappears. :(

What does this mean? We use ColorAnimation in a few places; I wonder if there is bug here? I think @teaP had similar difficulties but worked around them somehow?

@mdtauk
Copy link
Contributor

mdtauk commented Jan 9, 2021

The resource is a Brush, and when accessed through ColorAnimation's TargetProperty="(Panel.Background).(SolidColorBrush.Color)" it becomes buggy and simply disappears. :(

What does this mean? We use ColorAnimation in a few places; I wonder if there is bug here? I think @teaP had similar difficulties but worked around them somehow?

You could probably generate colour resources using code to grab the colour from the brush, and generate a colour resource in the Theme ResourceDictionaries.

@ranjeshj ranjeshj merged commit ecf6d59 into master Jan 9, 2021
@ranjeshj ranjeshj deleted the user/karenlai/UpdateAccentColour branch January 9, 2021 17:59
@karkarl karkarl restored the user/karenlai/UpdateAccentColour branch February 1, 2021 23:10
Kinnara added a commit to Kinnara/ModernWpf that referenced this pull request Jul 9, 2022
Kinnara added a commit to Kinnara/ModernWpf that referenced this pull request Jul 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Styling team-Controls Issue for the Controls team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants