adobe / leonardo

Generate colors based on a desired contrast ratio

Home Page:http://www.leonardocolor.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function for creating adaptive palette/theme

NateBaldwinDesign opened this issue · comments

Description

Create a package that allows for simpler creation of a full contrast-based color palette.
("theme" or "palette" is undecided)

generateContrastTheme() as @adobe/leonardo-contrast-theme

Function would accept destructured parameters for base and palette. The base parameter will accept an object containing the parameters for the generateBaseScale function. The palette parameter will be an array of objects, each containing the parameters for each generateContrastColors function.

// pseudo-code concept
generateContrastTheme({
   base: {},
   palette: []
}) {
   b = generateBaseScale(base)[]; // base parameter to create base scale (0-100)
   for (I=0; i < palette.length; i ++) {
       return generateContrastColors(i, b);
   }
}

Usage:

let myTheme = generateContrastTheme( */ parameters /* );
let lightTheme = myTheme(100);  // returns white theme all colors
let darkTheme = myTheme(0);  // returns white theme all colors

Steps to reproduce

Expected behavior

Screenshots

Environment

  • @leonardo-contrast-colors version:
  • Browser(s) and OS(s):

Additional context