HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/buyercall/node_modules/colornames/test.js
var test = require('tape')

var toHex = require('./index.js')

test('maps VGA color names to HEX values', function(t) {
  t.plan(3)
  t.equal(toHex('red'), '#FF0000')
  t.equal(toHex('blue'), '#0000FF')
  t.equal(toHex('BluE'), '#0000FF')
})

test('maps CSS color names to HEX values', function(t) {
  t.plan(3)
  t.equal(toHex('lightsalmon'), '#FFA07A')
  t.equal(toHex('mediumvioletred'), '#C71585')
  t.equal(toHex('meDiumVioletRed'), '#C71585')
})

test('meta data about a color', function(t) {
  t.plan(2)
  t.deepEqual(toHex.get('red'), {
    name: "red",
    css: true,
    value: "#FF0000",
    vga: true
  })
  t.deepEqual(toHex.get('rEd'), {
    name: "red",
    css: true,
    value: "#FF0000",
    vga: true
  })
})