Skip to content

Latest commit

 

History

History

normalize-rgb

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

@fantasy-color/normalize-rgb

Turn an RGB color value from 0-255 to take a value from 0-1

type normalizeRgb = (color: RGB) => RGB

Example usage:

import normalizeRgb from '@fantasy-color/normalize-rgb'

normalizeRgb({
  red: 255,
  green: 70,
  blue: 50
})
// > { red: 1, green: 0.27450980392156865, blue: 0.19607843137254902 }