0.0.9 • Published 6 years ago

react-string-color-parser v0.0.9

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

React String Color Parser

Pretty narrow use cases :)

  • npm install react-string-color-parser

Usage example

import Parser from 'react-string-color-parser';
...

<Parser
   tag="span"
   fontSize={16}
   delimiters={[{start: '${', end: '}'}, {start: '--[', end: ']--'}]}
   colors={['yellowgreen', 'tomato', 'skyblue', 'papayawhip']}
   defaultColor="black"
/>

Result Alt text

import Parser from 'react-string-color-parser';
...

<Parser
  colors={['yellowgreen', 'tomato', 'skyblue', 'papayawhip']}
  solidHighlight
  searchWords={['first', 'second']}
/>

Result Alt text

Props

  • tag - HTML tag to wrap string pieces. Default - 'span'

  • delimiters - an array of delimiters for parser to respect when dividing a string.

  • colors - an array of color representations for nested string parts.

  • fontSize - custom font size for input component. Default - 16px

  • defaultColor - a color for nesting depth that out of range due to size of colors array. Default - 'lightsalmon'

  • solidHighlight - A boolean flag defining whether to highlight text with background style. Default - false

  • searchWords - Dynamically treated array of strings to be highlighted when found. When specified - cancels delimiters rule!

  • caseSensitive - a boolean flag to set case sensitivity for searching words

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago