For the complete documentation index, see llms.txt. This page is also available as Markdown.

hsl

hsl(color: string): { 
    include: boolean, 
    matchs: RegExpMatchArray | null, 
    groups: Array<{ 
        hue: string | undefined,
        saturation: string | undefined,
        lightness: string | undefined
    } | null> | null
}

Search hsl color in a string:

const { global } = require('regex-simplify');

const color = global.hsl(`
    hsl(123, 45%, 67%)
`)

console.log(color);

And here what return the function:

{
  include: true,
  matchs: [ 'hsl(123, 45%, 67%)' ],
  groups: [
    [Object: null prototype] {     
      hue: '123',
      saturation: '45%',
      lightness: '67%'
    }
  ]
}

Last updated