colorgradient

package module
v0.0.0-...-56f55d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 2 Imported by: 1

README

colorgradient-go

colorgradient-go is a library for generating gradients in the Go language. It provides a simple API to create smooth gradients that transition between multiple colors.

Features

  • Create smooth gradients that transition between multiple colors
  • Get the color at any position
  • Simple API

Usage

package main

import (
	"image/color"
	"testing"

	"github.com/demouth/colorgradient-go"
)

func main() {
    grad, _ := colorgradient.NewGradient(
        color.RGBA64{0, 52942, 53713, 65535},
        color.RGBA64{0, 0, 0, 0},
        color.RGBA64{65535, 26985, 46260, 65535},
    )

    // Get colors at 0%, 50%, and 100%
    grad.At(0)   // color.RGBA64{0, 52942, 53713, 65535}
    grad.At(0.5) // color.RGBA64{0, 0, 0, 0}
    grad.At(1)   // color.RGBA64{65535, 26985, 46260, 65535}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gradient

type Gradient struct {
	// contains filtered or unexported fields
}

func NewGradient

func NewGradient(colors ...color.Color) (Gradient, error)

func (Gradient) At

func (lg Gradient) At(t float64) color.Color

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL