## Egendefinerte farger

Klikk her å velge farge:

Du kan enten lagre fargen i en egen variabel:

    TDT4102::Color chosenColor(100, 100, 100);

Eller bruke verdien direkte, for eksempel som verdi av en funksjonsparameter:

    TDT4102::Color(100, 100, 100)

Farger kan representeres på forskjellige måter. Det mest vanlige formatet er RGB (Rødt, Grønt, Blått). De ulike kanalene blandes i forskjellige mengder for å lage farger. Disse pleier å være verdier mellom 0 og 255 og det er de som brukes i Color-klassen. Prøv å velge hvit og deretter svart, og se hva som skjer med RGB-verdiene!

    unsigned char redChannel = 0;
    unsigned char greenChannel = 0;
    unsigned char blueChannel = 0;
    TDT4102::Color chosenColor(redChannel, greenChannel, blueChannel);

## Forhåndsdefinerte farger

Det er vanligvis lettere å bruke en forhåndsdefinert farge i stedet for å måtte lete etter RGB verdier. Derfor har vi forhåndsdefinert en rekke farger. Fargeverdiene du kan velge fra er vist i tabellen under.

Color verdi | Farge
TDT4102::Color::transparent | (transparant)
TDT4102::Color::black |
TDT4102::Color::silver |
TDT4102::Color::gray |
TDT4102::Color::white |
TDT4102::Color::maroon |
TDT4102::Color::red |
TDT4102::Color::purple |
TDT4102::Color::magenta |
TDT4102::Color::green |
TDT4102::Color::lime |
TDT4102::Color::olive |
TDT4102::Color::yellow |
TDT4102::Color::navy |
TDT4102::Color::blue |
TDT4102::Color::teal |
TDT4102::Color::aqua |
TDT4102::Color::orange |
TDT4102::Color::alice_blue |
TDT4102::Color::antique_white |
TDT4102::Color::aquamarine |
TDT4102::Color::azure |
TDT4102::Color::beige |
TDT4102::Color::bisque |
TDT4102::Color::blanched_almond |
TDT4102::Color::blue_violet |
TDT4102::Color::brown |
TDT4102::Color::burly_wood |
TDT4102::Color::cadet_blue |
TDT4102::Color::chart_reuse |
TDT4102::Color::chocolate |
TDT4102::Color::coral |
TDT4102::Color::cornflower_blue |
TDT4102::Color::corn_silk |
TDT4102::Color::crimson |
TDT4102::Color::cyan |
TDT4102::Color::dark_blue |
TDT4102::Color::dark_cyan |
TDT4102::Color::dark_goldenrod |
TDT4102::Color::dark_gray |
TDT4102::Color::dark_green |
TDT4102::Color::dark_grey |
TDT4102::Color::dark_khaki |
TDT4102::Color::dark_magenta |
TDT4102::Color::dark_olivegreen |
TDT4102::Color::dark_orange |
TDT4102::Color::dark_orchid |
TDT4102::Color::dark_red |
TDT4102::Color::dark_salmon |
TDT4102::Color::dark_seagreen |
TDT4102::Color::dark_slateblue |
TDT4102::Color::dark_slategray |
TDT4102::Color::dark_slategrey |
TDT4102::Color::dark_turquoise |
TDT4102::Color::dark_violet |
TDT4102::Color::dark_yellow |
TDT4102::Color::deep_pink |
TDT4102::Color::deep_skyblue |
TDT4102::Color::dim_gray |
TDT4102::Color::dim_grey |
TDT4102::Color::dodger_blue |
TDT4102::Color::firebrick |
TDT4102::Color::floral_white |
TDT4102::Color::forest_green |
TDT4102::Color::gainsboro |
TDT4102::Color::ghost_white |
TDT4102::Color::gold |
TDT4102::Color::goldenrod |
TDT4102::Color::green_yellow |
TDT4102::Color::grey |
TDT4102::Color::honeydew |
TDT4102::Color::hot_pink |
TDT4102::Color::indian_red |
TDT4102::Color::indigo |
TDT4102::Color::ivory |
TDT4102::Color::khaki |
TDT4102::Color::lavender |
TDT4102::Color::lavender_blush |
TDT4102::Color::lawn_green |
TDT4102::Color::lemon_chiffon |
TDT4102::Color::light_blue |
TDT4102::Color::light_coral |
TDT4102::Color::light_cyan |
TDT4102::Color::light_goldenrodyellow |
TDT4102::Color::light_gray |
TDT4102::Color::light_green |
TDT4102::Color::light_grey |
TDT4102::Color::light_pink |
TDT4102::Color::light_salmon |
TDT4102::Color::light_sea_green |
TDT4102::Color::light_sky_blue |
TDT4102::Color::light_slate_gray |
TDT4102::Color::light_slate_grey |
TDT4102::Color::light_steel_blue |
TDT4102::Color::light_yellow |
TDT4102::Color::lime_green |
TDT4102::Color::linen |
TDT4102::Color::medium_aquamarine |
TDT4102::Color::medium_blue |
TDT4102::Color::medium_orchid |
TDT4102::Color::medium_purple |
TDT4102::Color::medium_sea_green |
TDT4102::Color::medium_slate_blue |
TDT4102::Color::medium_spring_green |
TDT4102::Color::medium_turquoise |
TDT4102::Color::medium_violet_red |
TDT4102::Color::midnight_blue |
TDT4102::Color::mint_cream |
TDT4102::Color::misty_rose |
TDT4102::Color::moccasin |
TDT4102::Color::navajo_white |
TDT4102::Color::old_lace |
TDT4102::Color::olivedrab |
TDT4102::Color::orange_red |
TDT4102::Color::orchid |
TDT4102::Color::pale_goldenrod |
TDT4102::Color::pale_green |
TDT4102::Color::pale_turquoise |
TDT4102::Color::pale_violet_red |
TDT4102::Color::papayawhip |
TDT4102::Color::peachpuff |
TDT4102::Color::peru |
TDT4102::Color::pink |
TDT4102::Color::plum |
TDT4102::Color::powder_blue |
TDT4102::Color::rosy_brown |
TDT4102::Color::royal_blue |
TDT4102::Color::saddle_brown |
TDT4102::Color::salmon |
TDT4102::Color::sandy_brown |
TDT4102::Color::sea_green |
TDT4102::Color::sea_shell |
TDT4102::Color::sienna |
TDT4102::Color::sky_blue |
TDT4102::Color::slate_blue |
TDT4102::Color::slate_gray |
TDT4102::Color::slate_grey |
TDT4102::Color::snow |
TDT4102::Color::spring_green |
TDT4102::Color::steel_blue |
TDT4102::Color::tan |
TDT4102::Color::thistle |
TDT4102::Color::fuchsia |
TDT4102::Color::tomato |
TDT4102::Color::turquoise |
TDT4102::Color::violet |
TDT4102::Color::wheat |
TDT4102::Color::white_smoke |
TDT4102::Color::yellow_green |
TDT4102::Color::rebecca_purple |