1.0.5 • Published 14 days ago

dynamic-color-filter v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

dynamic-color-filter

This package can dynamically create CSS filters to manipulate colors.

Usage

Install the package, run the following command:

npm i dynamic-color-filter

Add dynamic-color-filter as a loader inside your webpack.config.js:

const config = {
    // ...
    module: {
        rules: [
            {
                test: /\.(sa|sc|c)ss$/i,
                use: [
                    'style-loader',
                    'css-loader',
                    'dynamic-color-filter', // Keep it above SASS loader
                    'sass-loader'
                ]
            },
        ],
    },
    // ...
}

Use the following syntax inside your (S)CSS:

element {
    width: auto; // For presentation purposes only

    color-filter-to: ([color]);

    // Other styles
    font-size: 1rem;
}

replace [color] with any valid CSS-Color like hotpink, #d5d5d5 or rgb(231, 231, 231). You can also use rgba, but the transparency will be ignored and the color will be treated as 100% opacity.

Utilize SCSS mixins:

@mixin color-filter-to($color) {
    color-filter-to: ($color);
}
1.0.5

14 days ago

1.0.4

4 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago