Skip to content

Photo Editor #18

@fsjsd

Description

@fsjsd

Basic canvas editor with HSL functions etc

http://www.graficaobscura.com/matrix/index.html
https://stackoverflow.com/questions/13806483/increase-or-decrease-color-saturation
https://stackoverflow.com/questions/49182276/how-to-efficiently-manipulate-pixels-in-html5-canvas
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas

export const shadeHexColor = (color, percent) => {
  const f = parseInt(color.slice(1), 16)
  const t = percent < 0 ? 0 : 255
  const p = percent < 0 ? percent * -1 : percent
  const R = f >> 16
  const G = f >> 8 & 0x00FF
  const B = f & 0x0000FF
  return '#' + (0x1000000 + (Math.round((t - R) * p) + R) * 0x10000 + (Math.round((t - G) * p) + G) * 0x100 + (Math.round((t - B) * p) + B)).toString(16).slice(1)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions