imgcolors

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 4 Imported by: 0

README

imgcolors

go.dev reference

Create image from colors

Examples

Horizontal
package main

import (
    "image/color"
    "math/rand"

    "github.com/mazznoer/imgcolors"
)

func main() {
    colors := make([]color.Color, 17)

    for i := range colors {
        colors[i] = randColor()
    }
    img := imgcolors.Horizontal(colors, 900, 70)
    // ...
}

func rand255() uint8 {
    return uint8(rand.Intn(255))
}

func randColor() color.Color {
    return color.RGBA{rand255(), rand255(), rand255(), 255}
}

example output

Try it online

Vertical
colors := make([]color.Color, 10)

for i := range colors {
    colors[i] = randColor()
}
img := imgcolors.Vertical(colors, 45, 45*10)

example output

Square
import "image/color/palette"

img := imgcolors.Square(palette.Plan9, 900)

example output

Conic
colors := make([]color.Color, 17)

for i := range colors {
    colors[i] = randColor()
}
img := imgcolors.Conic(colors, 800, 800)

example output

Radial
colors := make([]color.Color, 13)

for i := range colors {
    colors[i] = randColor()
}
img := imgcolors.Radial(colors, 800, 800)

example output

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conic

func Conic(colors []color.Color, width, height uint) image.Image

func Horizontal

func Horizontal(colors []color.Color, width, height uint) image.Image

func Radial

func Radial(colors []color.Color, width, height uint) image.Image

func Square

func Square(colors []color.Color, size uint) image.Image

func Vertical

func Vertical(colors []color.Color, width, height uint) image.Image

Types

This section is empty.

Jump to

Keyboard shortcuts

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