### Home Classes Methods

### In Files

- lib/rubygame/color/palettes/x11.rb
- lib/rubygame/color/palettes/css.rb
- lib/rubygame/color/models/hsv.rb
- lib/rubygame/color/models/base.rb
- lib/rubygame/color/models/rgb.rb
- lib/rubygame/color/models/hsl.rb
- lib/rubygame/color.rb

### Namespace

- MODULE Rubygame::Color::ColorBase
- CLASS Rubygame::Color::ColorHSL
- CLASS Rubygame::Color::ColorHSV
- CLASS Rubygame::Color::ColorRGB
- CLASS Rubygame::Color::Palette

### Methods

- ::[]
- ::[]=

### Files

- CREDITS
- LICENSE
- NEWS
- README
- ROADMAP
- custom_sdl_load_paths.rdoc
- getting_started.rdoc
- keyboard_symbols.rdoc
- macosx_install.rdoc
- managing_framerate.rdoc
- surface_palettes.rdoc
- windows_install.rdoc

### Class/Module Index

Quicksearch

- Rubygame
- Rubygame::ActiveEvent
- Rubygame::Clock
- Rubygame::Color
- Rubygame::Color::ColorBase
- Rubygame::Color::ColorHSL
- Rubygame::Color::ColorHSV
- Rubygame::Color::ColorRGB
- Rubygame::Color::Palette
- Rubygame::Event
- Rubygame::EventActions
- Rubygame::EventActions::BlockAction
- Rubygame::EventActions::MethodAction
- Rubygame::EventActions::MultiAction
- Rubygame::EventHandler
- Rubygame::EventHandler::HasEventHandler
- Rubygame::EventHook
- Rubygame::EventQueue
- Rubygame::EventTriggers
- Rubygame::EventTriggers::AndTrigger
- Rubygame::EventTriggers::AttrTrigger
- Rubygame::EventTriggers::BlockTrigger
- Rubygame::EventTriggers::InstanceOfTrigger
- Rubygame::EventTriggers::KeyPressTrigger
- Rubygame::EventTriggers::KeyReleaseTrigger
- Rubygame::EventTriggers::KindOfTrigger
- Rubygame::EventTriggers::MouseMoveTrigger
- Rubygame::EventTriggers::MousePressTrigger
- Rubygame::EventTriggers::MouseReleaseTrigger
- Rubygame::EventTriggers::OrTrigger
- Rubygame::EventTriggers::TickTrigger
- Rubygame::EventTriggers::YesTrigger
- Rubygame::Events
- Rubygame::Events::ClockTicked
- Rubygame::Events::InputFocusGained
- Rubygame::Events::InputFocusLost
- Rubygame::Events::JoystickAxisMoved
- Rubygame::Events::JoystickBallMoved
- Rubygame::Events::JoystickButtonEvent
- Rubygame::Events::JoystickButtonPressed
- Rubygame::Events::JoystickButtonReleased
- Rubygame::Events::JoystickHatMoved
- Rubygame::Events::KeyPressed
- Rubygame::Events::KeyReleased
- Rubygame::Events::KeyboardEvent
- Rubygame::Events::MouseButtonEvent
- Rubygame::Events::MouseFocusGained
- Rubygame::Events::MouseFocusLost
- Rubygame::Events::MouseMoved
- Rubygame::Events::MousePressed
- Rubygame::Events::MouseReleased
- Rubygame::Events::QuitRequested
- Rubygame::Events::WindowExposed
- Rubygame::Events::WindowMinimized
- Rubygame::Events::WindowResized
- Rubygame::Events::WindowUnminimized
- Rubygame::ExposeEvent
- Rubygame::Ftor
- Rubygame::GL
- Rubygame::Hotspot
- Rubygame::JoyAxisEvent
- Rubygame::JoyBallEvent
- Rubygame::JoyDownEvent
- Rubygame::JoyHatEvent
- Rubygame::JoyUpEvent
- Rubygame::Joystick
- Rubygame::Key
- Rubygame::KeyDownEvent
- Rubygame::KeyUpEvent
- Rubygame::MailQueue
- Rubygame::MediaBag
- Rubygame::Mixer
- Rubygame::Mixer::Music
- Rubygame::Mixer::Sample
- Rubygame::Mouse
- Rubygame::MouseDownEvent
- Rubygame::MouseMotionEvent
- Rubygame::MouseUpEvent
- Rubygame::Music
- Rubygame::NamedResource
- Rubygame::NamedResource::NamedResourceClassMethods
- Rubygame::QuitEvent
- Rubygame::Rect
- Rubygame::ResizeEvent
- Rubygame::SDLError
- Rubygame::SFont
- Rubygame::Screen
- Rubygame::Sound
- Rubygame::Sprites
- Rubygame::Sprites::DepthSortGroup
- Rubygame::Sprites::Group
- Rubygame::Sprites::LimitGroup
- Rubygame::Sprites::Sprite
- Rubygame::Sprites::UpdateGroup
- Rubygame::Surface
- Rubygame::TTF

No matching classes.

# Rubygame::Color

The Color module contains classes related to colors.

Available color representations:

ColorRGB | color class with red, green, and blue components.
ColorHSV | color class with hue, saturation, and value components.
ColorHSL | color class with hue, saturation, and luminosity components.

The Palette class allows you to conveniently store and access a collection of many different colors, with inheritance from included Palettes.

The available predefined palettes are:

X11 | palette with the default X11 colors
CSS | palette used with HTML and CSS, very similar to X11
GLOBAL | special palette used for automatic lookup (see below)

The GLOBAL palette is special; it is used for automatic color lookup in functions like Surface#draw_circle and TTF#render.It includes the CSS palette by default; you can include other palettes or define new custom colors in GLOBAL to make them available for automatic lookup.

For convenience, you can access the GLOBAL palette through the #[] and #[]= methods:

    include Rubygame
    player_color = Color[:red]
    Color[:favorite] = Color[:azure]

### Public Class Methods

[]( name ) click to toggle source

Retrieve a color from the GLOBAL palette. See Palette#[]

    # File lib/rubygame/color.rb, line 70
    def self.[]( name )
            GLOBAL[name]
    end

[]=( name, color ) click to toggle source

Store a color in the GLOBAL palette. See Palette#[]=

    # File lib/rubygame/color.rb, line 76
    def self.[]=( name, color )
            GLOBAL[name] = color
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.