Mi primer artículo sobre programación.
Es algo relativamente simple, pero que hay que hacerlo. El código propuesto implementa los colores de la paleta del proyecto Tango.
Esto es muy útil si usais iconos Tango, o del mismo estilo, y necesitáis colorear zonas con sólidos o degradados desde código.
Código
using System;
using System.Drawing;
namespace CC.Drawing
{
///
/// Paleta de colores propuestos en http://tango.freedesktop.org/Tango_Desktop_Project
///
public struct Tango
{
public static Color FromKnown(KnownTango color)
{
switch (color)
{
case KnownTango.Butter1: return Butter1;
case KnownTango.Butter2: return Butter2;
case KnownTango.Butter3: return Butter3;
case KnownTango.Chameleon1: return Chameleon1;
case KnownTango.Chameleon2: return Chameleon2;
case KnownTango.Chameleon3: return Chameleon3;
case KnownTango.Orange1: return Orange1;
case KnownTango.Orange2: return Orange2;
case KnownTango.Orange3: return Orange3;
case KnownTango.SkyBlue1: return SkyBlue1;
case KnownTango.SkyBlue2: return SkyBlue2;
case KnownTango.SkyBlue3: return SkyBlue3;
case KnownTango.Plum1: return Plum1;
case KnownTango.Plum2: return Plum2;
case KnownTango.Plum3: return Plum3;
case KnownTango.Chocolate1: return Chocolate1;
case KnownTango.Chocolate2: return Chocolate2;
case KnownTango.Chocolate3: return Chocolate3;
case KnownTango.ScarletRed1: return ScarletRed1;
case KnownTango.ScarletRed2: return ScarletRed2;
case KnownTango.ScarletRed3: return ScarletRed3;
case KnownTango.Aluminium1: return Aluminium1;
case KnownTango.Aluminium2: return Aluminium2;
case KnownTango.Aluminium3: return Aluminium3;
case KnownTango.Aluminium4: return Aluminium4;
case KnownTango.Aluminium5: return Aluminium5;
case KnownTango.Aluminium6: return Aluminium6;
default: return Color.Empty;
}
}
public static Color Butter1 { get { return Color.FromArgb(252, 233, 79); } }
public static Color Butter2 { get { return Color.FromArgb(237, 212, 0); } }
public static Color Butter3 { get { return Color.FromArgb(196, 160, 0); } }
public static Color Chameleon1 { get { return Color.FromArgb(138, 226, 52); } }
public static Color Chameleon2 { get { return Color.FromArgb(115, 210, 22); } }
public static Color Chameleon3 { get { return Color.FromArgb(78, 154, 6); } }
public static Color Orange1 { get { return Color.FromArgb(252, 175, 62); } }
public static Color Orange2 { get { return Color.FromArgb(245, 121, 0); } }
public static Color Orange3 { get { return Color.FromArgb(206, 92, 0); } }
public static Color SkyBlue1 { get { return Color.FromArgb(114, 159, 207); } }
public static Color SkyBlue2 { get { return Color.FromArgb(52, 101, 164); } }
public static Color SkyBlue3 { get { return Color.FromArgb(32, 74, 135 ); } }
public static Color Plum1 { get { return Color.FromArgb(173, 127, 168); } }
public static Color Plum2 { get { return Color.FromArgb(117, 80, 123); } }
public static Color Plum3 { get { return Color.FromArgb(92, 53, 102); } }
public static Color Chocolate1 { get { return Color.FromArgb(233, 185, 110); } }
public static Color Chocolate2 { get { return Color.FromArgb(193, 125, 17); } }
public static Color Chocolate3 { get { return Color.FromArgb(143, 89, 2); } }
public static Color ScarletRed1 { get { return Color.FromArgb(239, 41, 41); } }
public static Color ScarletRed2 { get { return Color.FromArgb(204, 0, 0); } }
public static Color ScarletRed3 { get { return Color.FromArgb(164, 0, 0); } }
public static Color Aluminium1 { get { return Color.FromArgb(238, 238, 236); } }
public static Color Aluminium2 { get { return Color.FromArgb(211, 215, 207); } }
public static Color Aluminium3 { get { return Color.FromArgb(186, 189, 182); } }
public static Color Aluminium4 { get { return Color.FromArgb(136, 138, 133); } }
public static Color Aluminium5 { get { return Color.FromArgb(85, 87, 83); } }
public static Color Aluminium6 { get { return Color.FromArgb(46, 52, 54); } }
}
public enum KnownTango
{
Butter1, Butter2, Butter3,
Chameleon1, Chameleon2, Chameleon3,
Orange1, Orange2, Orange3,
SkyBlue1, SkyBlue2, SkyBlue3,
Plum1, Plum2, Plum3,
Chocolate1, Chocolate2, Chocolate3,
ScarletRed1, ScarletRed2, ScarletRed3,
Aluminium1, Aluminium2, Aluminium3, Aluminium4, Aluminium5, Aluminium6
}
}
29 de marzo de 2014, 13:33
Thanks very nice blog!
Here is my web-site :: bombillasled