Git Product home page Git Product logo

Comments (1)

vnbaaij avatar vnbaaij commented on June 14, 2024

Not all design tokens are 'just' CSS variables. The accent-fill-... variables, for example, are in the script created by what is called a recipe. They are calculated based on a base color you supply to the token and take things like contrast ratio into account. If you specify those manualyy, you'll need to take care of that yourself. You also indeed need to use the !important addition to overrule the script generated values.

The first code example at https://www.fluentui-blazor.net/DesignTokens#using-design-tokens-from-code explicitly mentions how you can use a token 'globally':

// If you would like to change the BaseLayerLuminance  value for the whole site, you can use the WithDefault method
await BaseLayerLuminance.WithDefault((float)0.15);

To answer your questions:

  1. No, it is not advised to do this. You set the tokens and then needed CSS variables will be created for you. If you do it yourself, you will run into things like needing the !important

You can look at the code for the demo site on how we use the tokens to set application wide tokens as well. See also #2070
Moving this as it is not an issue but more a discussion

from fast-blazor.

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.