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

hex

hex(color: string): { 
    include: boolean, 
    matchs: RegExpMatchArray | null, 
    groups: Array<{ 
        color: string | undefined
    } | null> | null
}

Search hex color in a string:

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

const color = global.hex(`
    #F56
    0xF56
`)

console.log(color);

And here what return the function:

{
  include: true,
  matchs: [ '#F56', '0xF56' ],
  groups: [
    [Object: null prototype] { color: 'F56' },
    [Object: null prototype] { color: 'F56' }
  ]
}

Last updated