0.1.4 • Published 4 years ago

tinct v0.1.4

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

Tinct

Usage

Tinct comes loaded some default colors, so you can start right away. To get a color, simply retrieve it as follows

const green = Tinct.green;

Custom swatches

Customizing the color scheme is easy:

const swatch = new Swatch({
	name: 'awesomeSwatch',
    colors: {
    	red: new Color("#FF0000"),
        green: new Color("#00FF00"),
        blue: new Color("#0000FF")
    },
    shades: {
    	black: new Color("#000000"),
        white: new Color("#FFFFFF")
    }
});
Tinct.loadSwatch(swatch);

Tinct supports loading multiple swatches. In the previous example, you can still request Tinct.purple as it comes with the default swatch. If you want to remove the basic swatch, you can call either of the functions below, depending on your use-case.

Tinct.removeSwatch('basic');
Tinct.removeAllSwatches();

Custom shaders

Adding a custom shader is similar to adding a custom swatch.

const shader = new Shader({
	name: 'awesomeShader',
    nameStyle: 'prefix',
    shaders: {
    	awesome: (color, manager) => {
        	// Do whatever you want to
        }
    }
});
Tinct.loadShaderPack(shader);

Once you've loaded this shader, you can request Tinct.awesomeRed.

Again, we support loading multiple shaders. If you want to remove a shader, you can call either function below.

Tinct.removeShaderPack('basic');
Tinct.removeAllShaderPacks();

Color destructuring

To determine what color is requested, Tinct tries to find a color name in the name you provide. What is left before and after the match are used as shaders. So the string awesomeRed500 is matched as red, with the awesome and 500 shaders. Note that this causes confusion with colors as extraLightBlue, as Tinct can interpret this as lightBlue with the extra shader when a lightBlue color is loaded.

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago