Giter Site home page Giter Site logo

Comments (2)

benruehl avatar benruehl commented on May 22, 2024

I see this is kind of misleading, sorry for that. The ResourceAliasExtension should be either public or the docs should be more clear about how to create custom color schemes.

I'll try to explain it a little more detailed here.

If you want to create a whole new color scheme you can create a new ResourceDictionary file and add a new Color for each key in AdonisUI.Colors and a new Brush (e.g. SolidColorBrush) for each key in AdonisUI.Brushes. Don't forget to use AdonisUI's keys for all those resources, e.g.:

<Color x:Key="{x:Static adonisUi:Colors.AccentColor}">#0BAC08</Color>
<!-- all colors go here -->

<SolidColorBrush x:Key="{x:Static adonisUi:Brushes.AccentBrush}" Color="{DynamicResource {x:Static adonisUi:Colors.AccentColor}}"/>
<!-- all brushes go here -->

If you want to use a shipped color scheme and customize only some resources you can create a new ResourceDictionary file and make it include the theme you want to derive from in its ResourceDictionary.MergedDictionaries. Afterwards, you can create colors as you like and assign the color keys you want to override.

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:AdonisUITest"
                    xmlns:adonisUi="clr-namespace:AdonisUI;assembly=AdonisUI">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/AdonisUI;component/ColorSchemes/Light.xaml"/>
    </ResourceDictionary.MergedDictionaries>

    <Color x:Key="{x:Static adonisUi:Colors.AccentColor}">Green</Color>
    <!-- additional colors or brushes go here -->
    
</ResourceDictionary>

The colors and brushes you did not specify are then taken from the included color scheme. You can include this ResourceDictionary in your App.xaml instead of the light and dark color schemes or in addition to them if you want to switch between those.

So now regarding your question: The ResourceAliasExtension is only used for Layer0BorderColor (and the associated brush). You can now either leave this color as it is by including the light color scheme and simply not overriding it. Or you assign a new value to it like mentioned:

<Color x:Key="{x:Static adonisUi:Colors.Layer0BorderColor}">#404040</Color>

Hope this helps :)

from adonis-ui.

dbruning avatar dbruning commented on May 22, 2024

Yes that does help, thanks!
I didn't think to use the Adonis Light.xaml as a MergedDictionary inside my own ColorScheme. That's much better than copying the whole thing.

from adonis-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.