Skip to content

devdanim/dnm-react-color-chart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Get started

npm install dnm-react-color-chart

Example

import DnmColorChart from '../dist/dnm-react-color-chart.es';
 
const layout = {
    "main-darker": {
        "name": "Main Darker",
        "offset_from": "main",
        "offset_hsl": {
            "h": 0,
            "s": -10,
            "l": -20
        }
    },
    "main": {
        "name": "Main Color"
    },
    "secondary-color": {
        "name": "Secondary Color"
    },
    "background-color": {
        "name": "Background Color",
        "static": "#648fb5"
    }
};

const colors = {
    "main": "#49dc5b",
    "secondary-color": "#3d78ab"
}

const handleColorClick = (event, { id, value }) => {
    console.log(event, { id, value });
}

const root = createRoot(document.getElementById('root'));
root.render(
    <DnmColorChart
        classes={{
            item: "color-chart-item",
            root: "color-chart-root"
        }}
        layout={layout}
        colors={colors}
        onColorClick={handleColorClick}
    />
);

Read more

https://docs.danim.com/docs/danim-docs/en/latest/dev/json-structure.html

About

React component to visualize a Danim color chart

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published