GithubHelp home page GithubHelp logo

zyylele123 / colorsys-go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cckuailong/colorsys-go

0.0 1.0 0.0 7 KB

:rainbow: colorsys-go is a go package(or lib) for everyone to transform one color system to another. The transformation is among RGB, YIQ, HLS and HSV.

Go 100.00%

colorsys-go's Introduction

colorsys-go

What is colorsys-go

colorsys-go is a go package(or lib) for everyone to transform one color system to another. The transformation is among RGB, YIQ, HLS and HSV.

The repertory MosaicImage has use the package correctly.

Install

go get github.com/cckuailong/colorsys-go

Import

import "github.com/cckuailong/colorsys-go"

How to use it

Parameter Range

All inputs and outputs are three floats in the range [0.0...1.0] (with the exception of I and Q, which covers a slightly larger range also with the exception of R, G and B, which range from 0 to 255 also with the exception of H, which range from 0 to 360).

range of each parameter
R, G, B :    0 ~ 255
I, Q :      -1 ~ 1.X
H :          0 ~ 360
Y, S, V, L : 0 ~ 1

Examples

  1. RGB to YIQ
y, i, q := colorsys.Rgb2Yiq(r, g, b)
  1. YIQ to RGB
r, g, b := colorsys.Yiq2Rgb(y, i, q)
  1. RGB to HLS
h, l, s := colorsys.Rgb2Hls(r, g, b)
  1. HLS to RGB
r, g, b := colorsys.Hls2Rgb(h, l, s)
  1. RGB to HSV
h, s, v := colorsys.Rgb2Hsv(r, g, b)
  1. HSV to RGB
r, g, b := colorsys.Hsv2Rgb(h, s, v)
  1. Yiq to Hls
h, l, s := colorsys.Yiq2Hls(y, i, q)
  1. YIQ to HSV
h, s, v := colorsys.Yiq2Hsv(y, i, q)
  1. HLS to YIQ
y, i, q := colorsys.Hls2Yiq(h, l, s)
  1. HLS to HSV
h, s, v := colorsys.Hls2Hsv(h, l, s)
  1. HSV to YIQ
y, i, q := colorsys.Hsv2Yiq(h, s, v)
  1. HSV to HLS
h, l, s := colorsys.Hsv2Hls(h, s, v)

Contact

Any questions, welcome to email me at [email protected]

My Blog is lovebear.top

colorsys-go's People

Contributors

cckuailong avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.