
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
github.com/jacastanon01/color-picker
This is an exploration of how pixels store color. My goal with this project is to learn more about differents way to generate data that can be used for colors. I used raylib to create a simple color spectrum where you can pick a color and see the resulting value of the pixel in RGB format.
Color is a visual perception created by the interaction of light with our eyes. Light consists of electromagnetic waves, and when it strikes an object, certain wavelengths are absorbed while others are reflected. Our eyes perceive these reflected wavelengths as color. In digital systems, color is often represented using the RGB (Red, Green, Blue) model, which combines these three primary colors of light at varying intensities to create a spectrum of colors. Alternatively, the HSL (Hue, Saturation, Lightness) model measures color differently by defining its hue (the type of color), saturation (the intensity of the color), and lightness (the brightness of the color). When creating a color palette with only two pigments, the resulting spectrum is limited, often focusing on gradients between the two, producing a harmonious and visually cohesive range of colors. I generated the HSL values based on pixel position and then converted that data into an RGB format:
func GenerateSpectrum(w, h int32) *rl.Image {
const min, max float32 = 0.5, 1.0
image := rl.GenImageColor(int(w), int(h), rl.Blank)
for y := int32(0); y < h; y++ {
for x := int32(0); x < w; x++ {
var hue float32 = scaleValue((float32(x) / float32(w)), 360, 0)
var saturation float32 = 1 // default to full saturation
var brightness float32 = scaleValue(float32(y)/float32(h), max, min)
imageRGB := rl.ColorFromHSV(hue, saturation, brightness)
rl.ImageDrawPixel(
image, x, y, imageRGB,
)
}
}
return image
}
git clone https://github.com/jacastanon01/color-picker.git
go run cmd/colorpicker/main.go
at the rootFAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.