This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0 1.0.1

Random.Color

List of Color Generators

Generators

rgb : Generator Color

Generate a random non-transparent color by random RGB values.

rgba : Generator Color

Generate a random transparent color by random RGBA values.

hsl : Generator Color

Generate a random non-transparent color by random HSL values.

hsla : Generator Color

Generate a random transparent color by random HSLA values.

greyscale : Generator Color

Generate a random shade of grey

grayscale : Generator Color

Alias for greyscale

red : Generator Color

Generate a random shade of red.

green : Generator Color

Generate a random shade of green.

blue : Generator Color

Generate a random shade of blue.

module Random.Color exposing (..)

{-| List of Color Generators

# Generators
@docs rgb, rgba, hsl, hsla, greyscale, grayscale, red, green, blue

-}

import Color exposing (Color)
import Random exposing (Generator, map, map3, map4, int, float)


{-| Generate a random non-transparent color by random RGB values.
-}
rgb : Generator Color
rgb =
    map3 Color.rgb (int 0 255) (int 0 255) (int 0 255)


{-| Generate a random transparent color by random RGBA values.
-}
rgba : Generator Color
rgba =
    map4 Color.rgba (int 0 255) (int 0 255) (int 0 255) (float 0 1)


{-| Generate a random non-transparent color by random HSL values.
-}
hsl : Generator Color
hsl =
    map3 Color.hsl (map degrees (float 0 360)) (float 0 1) (float 0 1)


{-| Generate a random transparent color by random HSLA values.
-}
hsla : Generator Color
hsla =
    map4 Color.hsla (map degrees (float 0 360)) (float 0 1) (float 0 1) (float 0 1)


{-| Generate a random shade of grey
-}
greyscale : Generator Color
greyscale =
    map Color.greyscale (float 0 1)


{-| Alias for greyscale
-}
grayscale : Generator Color
grayscale =
    greyscale


{-| Generate a random shade of red.
-}
red : Generator Color
red =
    map (\red -> Color.rgb red 0 0) (int 0 255)


{-| Generate a random shade of green.
-}
green : Generator Color
green =
    map (\green -> Color.rgb 0 green 0) (int 0 255)


{-| Generate a random shade of blue.
-}
blue : Generator Color
blue =
    map (\blue -> Color.rgb 0 0 blue) (int 0 255)