Class: Spreadsheet::Excel::Rgb

### Home Classes Methods

### In Files

- lib/spreadsheet/excel/rgb.rb

### Parent

Object

### Methods

- ::new
- ::to_rgb
- #as_hex
- #to_i

### Files

- LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Spreadsheet
- Spreadsheet::Column
- Spreadsheet::Compatibility
- Spreadsheet::Datatypes
- Spreadsheet::Encodings
- Spreadsheet::Errors
- Spreadsheet::Excel
- Spreadsheet::Excel::Error
- Spreadsheet::Excel::ExcelCompatibleWorkbook
- Spreadsheet::Excel::Internals
- Spreadsheet::Excel::Internals::Biff5
- Spreadsheet::Excel::Internals::Biff8
- Spreadsheet::Excel::Offset
- Spreadsheet::Excel::Password
- Spreadsheet::Excel::Reader
- Spreadsheet::Excel::Reader::Biff5
- Spreadsheet::Excel::Rgb
- Spreadsheet::Excel::Row
- Spreadsheet::Excel::SstEntry
- Spreadsheet::Excel::Workbook
- Spreadsheet::Excel::Worksheet
- Spreadsheet::Font
- Spreadsheet::Format
- Spreadsheet::Formula
- Spreadsheet::Helpers
- Spreadsheet::Link
- Spreadsheet::Note
- Spreadsheet::NoteObject
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::Worksheet
- Spreadsheet::ParseExcel::Worksheet::Cell
- Spreadsheet::Row
- Spreadsheet::Workbook
- Spreadsheet::Worksheet
- Spreadsheet::Writer

No matching classes.

# Spreadsheet::Excel::Rgb

### Attributes

b[RW]
g[RW]
r[RW]

### Public Class Methods

new(r,g,b) click to toggle source

    # File lib/spreadsheet/excel/rgb.rb, line 107
    def initialize(r,g,b)
       @r = r & 0xff
       @g = g & 0xff
       @b = b & 0xff
    end

to_rgb(color_symbol) click to toggle source

    # File lib/spreadsheet/excel/rgb.rb, line 101
    def self.to_rgb color_symbol
      col = @@RGB_MAP[color_symbol]
      return Rgb.new(col >> 16, (col & 0xff00) >> 8, col & 0xff) if col
      nil
    end

### Public Instance Methods

as_hex() click to toggle source

    # File lib/spreadsheet/excel/rgb.rb, line 117
    def as_hex
       to_i.to_s(16)
    end

to_i() click to toggle source

    # File lib/spreadsheet/excel/rgb.rb, line 113
    def to_i
       (r * (256 * 256)) + (g * 256) + b
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.