1.8.0 • Published 11 months ago

colors-helper-tools v1.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

🎨 colors-helper-tools

We help you use color.

Version Info

versionnode version
1.0.0+14+

Installation

# npm
$ npm install --save colors-helper-tools

# yarn
$ yarn add colors-helper-tools

test functions

$ npm run test

CLI

  • you can get random colors with cli
npx cht -h

return types are Hex string or Color type

type Color = {
  red: number;
  green: number;
  blue: number;
};

functions

toRgb

  • hex color string to rgb object

toHex

  • make number to hex string

toHexColor

  • make numbers to hex color string

complementaryColorHex

  • get complementary color hex string

complementaryColorRgb

  • get complementary color object

random color parms options (enum)

export enum RandomColorType {
  red = 'red',
  green = 'green',
  blue = 'blue',
  all = 'all',
}

getRandomColorHex

  • get random color hex string
  • give params (red, green, blue) to get concrete random color hex

getRandomColorRgb

  • get random color object
  • give params (red, green, blue) to get concrete random color object

pasteltoneRgb

  • get random pastel tone color
  • return Color type

pasteltoneHex

  • get random pastel tone color
  • return hex string

neutraltoneRgb

  • get random neutral tone color
  • return Color type

neutraltoneHex

  • get random neutral tone color
  • return hex string

getColorByStepRgbGen

  • Returns a generator function that sequentially intensifies the returned Color object
const fn = getColorByStepRgbGen(50)(); // generator
for (let i = 0; i < 10; i++) {
  console.log(fn.next().value); // Color object
}

getColorByStepHexGen

  • Returns a generator function that sequentially intensifies the returned color hex string
const fn = getColorByStepHexGen(50)(); // generator
for (let i = 0; i < 10; i++) {
  console.log(fn.next().value); // hex string
}

getColorByStepRgb

  • You can use getColorByStepRgbGen without understanding generator functions.
const fn = getColorByStepRgb(50); // function
for (let i = 0; i < 10; i++) {
  console.log(fn()); // Color object
}

getColorByStepHex

  • You can use getColorByStepHexGen without understanding generator functions.
const fn = getColorByStepHex(50); // function
for (let i = 0; i < 10; i++) {
  console.log(fn()); // hex string
}

🎈 examples

  • emotion
  • jsx_inline
  • react_memo
  • complementary_color

ETC

  • git push github action config example
    • push_example.yml
1.8.0

11 months ago

1.7.10

1 year ago

1.7.3

1 year ago

1.7.2

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.7.9

1 year ago

1.7.8

1 year ago

1.7.7

1 year ago

1.7.6

1 year ago

1.7.5

1 year ago

1.7.4

1 year ago

1.6.9

1 year ago

1.6.8

1 year ago

1.6.7

1 year ago

1.6.4

1 year ago

1.6.3

1 year ago

1.6.0

1 year ago

1.5.9

1 year ago

1.5.8

1 year ago

1.6.6

1 year ago

1.6.5

1 year ago

1.5.5

2 years ago

1.5.7

2 years ago

1.5.6

2 years ago

1.5.4

2 years ago

1.1.1

2 years ago

1.5.3

2 years ago

1.5.2

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago