JSPM

prismaek

0.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 6
    • Score
      100M100P100Q18850F
    • License MIT

    Generate custom color schemes using maths.

    Package Exports

    • prismaek

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prismaek) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Prismaek

    Generate custom color schemes using maths. Color type conversion utilities included!

    License: MIT

    Usage

    const prismaek = require('prismaek')
    
    const { splitComplementary } = prismaek.harmonies
    const { RGB2HSV } = prismaek.utils
    
    // start with a single color
    const rgb = { r: 255, g: 102, b: 69 }
    
    // convert to HSV color format
    const hsv = RGB2HSV(rgb) // {h: 11, s: 0.729, v: 1}
    
    // note: HSV (HSB) format is required for scheme generation.
    const scheme = splitComplementary(hsv)
    /*
        [
            { h: 11, s: 0.729, v: 1 },
            { h: 161, s: 0.729, v: 1 },
            { h: 221, s: 0.729, v: 1 }
        ]
    */

    If you need a scheme in a particular form:

    let scheme = analagous(hsv)
    
    scheme = scheme.map(e => HSV2RGB(e))
    /*
        [
            { r: 255, g: 103, b: 69 },
            { r: 255, g: 196, b: 69 },
            { r: 221, g: 255, b: 69 },
            { r: 128, g: 255, b: 69 }
        ]
    */
    
    schemes = schemes.map(e => HSV2Hex(e))
    /*
        [ 'FF6745', 'FFC445', 'DDFF45', '80FF45' ]
    */