1.4.1 • Published 8 months ago
@sillybit/colorhacks v1.4.1
Colorhacks
Colorhacks is a collection of color conversion and manipulation utilities for TypeScript.
Install
npm
npm install @sillybit/colorhacks
yarn
yarn add @sillybit/colorhacks
pnpm
pnpm add @sillybit/colorhacks
bun
bun add @sillybit/colorhacks
Usage
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.