libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::Color Class Reference

Detailed Description

Class for handling simple colors

#include <color.h>

Public Types

enum  PresetColor {
  RED , GREEN , BLUE , WHITE ,
  PURPLE , CYAN , GOLD , OFF ,
  LAST
}
 

Public Member Functions

 Color ()
 
 Color (float r, float g, float b)
 
 ~Color ()
 
void Init (PresetColor c)
 
void Init (float red, float green, float blue)
 
float Red () const
 
float Green () const
 
float Blue () const
 
uint8_t Red8 () const
 
uint8_t Green8 () const
 
uint8_t Blue8 () const
 
void SetRed (const float amt)
 
void SetGreen (const float amt)
 
void SetBlue (const float amt)
 
Color operator* (float scale)
 
Color operator+ (Color rhs)
 

Static Public Member Functions

static Color Blend (const Color a, const Color b, const float amt)
 

Member Enumeration Documentation

◆ PresetColor

List of colors that have a preset RGB value

Enumerator
RED 

&

GREEN 

&

BLUE 

&

WHITE 

&

PURPLE 

&

CYAN 

&

GOLD 

&

OFF 

&

LAST 

&

Constructor & Destructor Documentation

◆ Color() [1/2]

daisy::Color::Color ( )
inline

◆ Color() [2/2]

daisy::Color::Color ( float  r,
float  g,
float  b 
)
inline

◆ ~Color()

daisy::Color::~Color ( )
inline

Member Function Documentation

◆ Blend()

static Color daisy::Color::Blend ( const Color  a,
const Color  b,
const float  amt 
)
inlinestatic

Returns a color that is blended between a and b

◆ Blue()

float daisy::Color::Blue ( ) const
inline

Returns the 0-1 value for Blue

◆ Blue8()

uint8_t daisy::Color::Blue8 ( ) const
inline

◆ Green()

float daisy::Color::Green ( ) const
inline

Returns the 0-1 value for Green

◆ Green8()

uint8_t daisy::Color::Green8 ( ) const
inline

◆ Init() [1/2]

void daisy::Color::Init ( float  red,
float  green,
float  blue 
)

Initializes the Color with a specific RGB value red, green, and blue should be floats between 0 and 1

Parameters
redRed value
greenGreen value
blueBlue value

◆ Init() [2/2]

void daisy::Color::Init ( PresetColor  c)

Initializes the Color with a given preset.

Parameters
cColor to init to

◆ operator*()

Color daisy::Color::operator* ( float  scale)
inline

Returns a scaled color by a float

◆ operator+()

Color daisy::Color::operator+ ( Color  rhs)
inline

Adds another color to this one, destructively saturating at 1

◆ Red()

float daisy::Color::Red ( ) const
inline

Returns the 0-1 value for Red

◆ Red8()

uint8_t daisy::Color::Red8 ( ) const
inline

◆ SetBlue()

void daisy::Color::SetBlue ( const float  amt)
inline

◆ SetGreen()

void daisy::Color::SetGreen ( const float  amt)
inline

◆ SetRed()

void daisy::Color::SetRed ( const float  amt)
inline

The documentation for this class was generated from the following file: