Code Monkey home page Code Monkey logo

Comments (4)

p0nce avatar p0nce commented on August 26, 2024

Will be hard to replace dplug:graphics without it since in dplug:graphics you can assign pixels with a RGBA() struct, but the image is monomorphic. Should the struct be there?

from gamut.

p0nce avatar p0nce commented on August 26, 2024

The original code from Manu isn't bad at all... a bit templatey maybe

from gamut.

p0nce avatar p0nce commented on August 26, 2024

But we need a ICC profile parser too. Could be basis for colorspace.
ICC parsing and acting on it could bring support for XYB JPEGs.

from gamut.

p0nce avatar p0nce commented on August 26, 2024

Color API out there:

raylib: (only sRGB)

    Color Fade(Color color, float alpha);                                 // Get color with alpha applied, alpha goes from 0.0f to 1.0f
    int ColorToInt(Color color);                                          // Get hexadecimal value for a Color
    Vector4 ColorNormalize(Color color);                                  // Get Color normalized as float [0..1]
    Color ColorFromNormalized(Vector4 normalized);                        // Get Color from normalized values [0..1]
    Vector3 ColorToHSV(Color color);                                      // Get HSV values for a Color, hue [0..360], saturation/value [0..1]
    Color ColorFromHSV(float hue, float saturation, float value);         // Get a Color from HSV values, hue [0..360], saturation/value [0..1]
    Color ColorTint(Color color, Color tint);                             // Get color multiplied with another color
    Color ColorBrightness(Color color, float factor);                     // Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
    Color ColorContrast(Color color, float contrast);                     // Get color with contrast correction, contrast values between -1.0f and 1.0f
    Color ColorAlpha(Color color, float alpha);                           // Get color with alpha applied, alpha goes from 0.0f to 1.0f
    Color ColorAlphaBlend(Color dst, Color src, Color tint);              // Get src alpha-blended into dst color with tint
    Color GetColor(unsigned int hexValue);                                // Get Color structure from hexadecimal value
    Color GetPixelColor(void *srcPtr, int format);                        // Get Color from a source pixel pointer of certain format
    void SetPixelColor(void *dstPtr, Color color, int format);            // Set color formatted into destination pixel pointer
    int GetPixelDataSize(int width, int height, int format);              // Get pixel data size in bytes for certain format

CSS color-mod
CSS defines and allows all kinds of colorspaces, such as sRGB, Lch, oklab, Rec2020...

.box {
  color: color-mod(purple lightness(62%) red(218) blue(202) whiteness(25%));
  color: color-mod(hotpink blend(yellow 59%));
}

Here’s a list of available color adjusters:

alpha: A value for the alpha-transparency between 0% and 100%.
red, green & blue: A value between 0 and 255. Given a starting color of rgb(140, 254, 255), the starting red value would be 140, so anything higher than 140 increases the amount of red in the color and anything lower than 140 decreases the amount of red in color. Green and blue work the same way, with affecting their respective color.
blackness & whiteness: A value between 0% and 100%.
contrast: A value between 0% and 100%.
saturation: A value between 0% and 100%. 0% is gray.
lightness: A value between 0% and 100%. 0% is black, and 100% is white.
tint: A value between 0% and 100%.
hue: A value between 0 and 360.
shade: A value between 0% and 100%. 100% is black.
blend: Blend makes it easy to blend a color with another color. Here’s an example if it’s usage:

from gamut.

Related Issues (20)

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.