Coder Social home page Coder Social logo

geekysrm / iot-ux-fluent-css Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azure/iot-ux-fluent-css

0.0 2.0 1.0 295 KB

A minimal set of styles, themes and colors that are standardized across the Azure IoT organization.

License: MIT License

CSS 100.00%

iot-ux-fluent-css's Introduction

Azure IoT Fluent CSS Library

The Azure IoT Fluent CSS Library is a minimal set of styles, themes and colors that are standardized across the Azure IoT organization. It is created to help unify the look and feel of common experiences across the various teams. The library provides extremely easy theming using predefined color variables.

Usage

Install as a package via npm with the command npm install @microsoft/azure-iot-ux-fluent-css.

In your custom.scss, you’ll import the library's source Sass files. You are free to pick and choose the parts that you need.

@import "~@microsoft/azure-iot-ux-fluent-css/src/colors";
@import "~@microsoft/azure-iot-ux-fluent-css/src/mixins";

With that setup in place, you can begin to modify any of the Sass variables and maps in your custom.scss.

Theming

To theme your app, wrap the themed properties in @themify mixin.

.symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: $gutter-small;

    @include themify {
        fill: themed('color-fill-tile-symbol');
        stroke: themed('color-stroke-tile-symbol');
    }    
}

The above SCSS will generate two separate theme variations.

.symbol {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px;
}

.theme-dark .symbol {
    fill: #FFFFFF;
    stroke: #FFFFFF; 
}

.theme-light .symbol {
    fill: #212121;
    stroke: #212121;
}

This technique is relatively efficient, as only the necessary css markups that vary between the themes are generated.

Customization

It is easy to customize and build on top of the Common IoT Fluent CSS Library. The library includes the colors in a Sass map of key value pairs. All Sass maps include the !default flag and can be overridden and extended without modifying the library's source code.

Modify map

To modify an existing color in our $themes map, simply redefine the key value pair in your custom Sass file:

$theme-dark: (
    color-fill-tile-symbol: #ff4136
);

Add to map

To add a new color to one of our existing themes, add the new key and value:

$theme-dark: (
    color-fill-tile-symbol-new: #aa4136
);

Remove from map

To remove colors from $themes, use map-remove:

$theme-dark: map-remove($theme-dark, "color-fill-tile-symbol");

Extend $themes with a custom theme

To extend the $themes map with new themes, add the new map of colors:

$themes: (
    christmas: (
        color-fill-tile-symbol: #ff4136,
        color-stroke-tile-symbol: #36FF53
    )    
);

See the example directory for sample consumption code. Use npm run build to see the sample css output.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

iot-ux-fluent-css's People

Contributors

coord avatar misteinb avatar vishwam avatar princjef avatar connor-wood avatar vincenzocaruso avatar

Watchers

James Cloos avatar Soumya Ranjan Mohanty avatar

Forkers

marciopocebon

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.