1.0.3 • Published 5 years ago

extract-color-from-text v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

About

This package provides a function which will extract text color value from predefined array of color like values.

  • Comparison of the words is case-insensitive.
  • Word separators are space, start/end of strong, trailing plus sign.

Example

"My favourite color is purple" will result in "purple"

Usage

Default language to use is english

const text = 'My favourite color is purple';
const color = extractColor(text); // purple

const text = 'No color specified';
const color = extractColor(text); // ''

Using different language is possible by providing second parameter to the extractColor function.

const text = 'My favourite color is goud';
const color = extractColor(text, 'be'); // goud

Supported languages

  • en - english, the default one
  • be - belgium
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago