1.5.7 • Published 10 months ago

colors-helper-tools v1.5.7

Weekly downloads
-
License
MIT
Repository
github
Last release
10 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

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.5.5

10 months ago

1.5.7

10 months ago

1.5.6

10 months ago

1.5.4

11 months ago

1.1.1

1 year ago

1.5.3

12 months ago

1.5.2

12 months ago

1.5.1

12 months ago

1.5.0

12 months ago

1.4.1

12 months ago

1.4.0

12 months ago

1.3.0

12 months ago

1.2.1

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago