@sillybit/colorhacks
v1.4.1
Published
A collection of color utility functions
Maintainers
Readme
Colorhacks
Colorhacks is a collection of color conversion and manipulation utilities for TypeScript.
Install
npm
npm install @sillybit/colorhacksyarn
yarn add @sillybit/colorhackspnpm
pnpm add @sillybit/colorhacksbun
bun add @sillybit/colorhacksUsage
import { getColorNameFromHex } from '@sillybit/colorhacks';
getColorNameFromHex('#FF0000');
// returns { hexcode: '#ff0000', colorName: 'Red', isExactMatch: true, shadeHex: '#ff0000', shadeName: 'Red', distance: 0 }import { generateTheme } from '@sillybit/colorhacks';
generateTheme({
baseColor: '#FF0000',
expandPalette: true,
colorScheme: 'complementary',
infoHue: 200,
successHue: 120,
warningHue: 40,
errorHue: 0,
});
// returns { brand: { ... }, primary: { ... }, secondary: { ... }, accent: { ... }, neutral: { ... }, info: { ... }, success: { ... }, warning: { ... }, error: { ... }, schemeColors: [ ... ] }API
For more examples and API details, see the docs.
License
You can use this under the MIT license. See the LICENSE file for more details.
Contributing
We welcome contributions to this project. Please read our CONTRIBUTING.md file for more details.
