本文整理汇总了C#中Corale.Colore.Core.Color类的典型用法代码示例。如果您正苦于以下问题:C# Color类的具体用法?C# Color怎么用?C# Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Color类属于Corale.Colore.Core命名空间,在下文中一共展示了Color类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Custom
/// <summary>
/// Initializes a new instance of the <see cref="Custom" /> struct with
/// a default color for each LED.
/// </summary>
/// <param name="color">The color to set each LED to initially.</param>
public Custom(Color color)
{
Colors = new Color[Constants.MaxLeds];
for (var i = 0; i < Colors.Length; i++)
Colors[i] = color;
}
示例2: Breathing
/// <summary>
/// Initializes a new instance of the <see cref="Breathing" /> struct.
/// </summary>
/// <param name="led">The LED on which to apply the effect.</param>
/// <param name="type">The type of breathing effect to create.</param>
/// <param name="first">The initial <see cref="Color" /> to use.</param>
/// <param name="second">The second color.</param>
public Breathing(Led led, BreathingType type, Color first, Color second)
{
Led = led;
Type = type;
First = first;
Second = second;
}
示例3: Reactive
/// <summary>
/// Initializes a new instance of the <see cref="Reactive" /> struct.
/// </summary>
/// <param name="duration">Effect duration.</param>
/// <param name="color">Effect color.</param>
/// <param name="parameter">Additional effect parameter.</param>
public Reactive(Duration duration, Color color, int parameter = 0)
{
Duration = duration;
Color = color;
Parameter = parameter;
Size = Marshal.SizeOf(typeof(Reactive));
}
示例4: Breathing
/// <summary>
/// Initializes a new instance of the <see cref="Breathing" /> struct.
/// </summary>
/// <param name="type">The type of breathing effect to create.</param>
/// <param name="first">Primary effect color.</param>
/// <param name="second">Secondary effect color.</param>
/// <param name="parameter">Additional effect parameter to set.</param>
public Breathing(BreathingType type, Color first, Color second, int parameter = 0)
{
Type = type;
First = first;
Second = second;
Parameter = parameter;
Size = Marshal.SizeOf(typeof(Breathing));
}
示例5: AnimatedKey
public AnimatedKey(Key key, Color color)
{
this.razerKey = key;
this.color = color;
this.red = color.R;
this.green = color.G;
this.blue = color.B;
this.alpha = color.A;
}
示例6: ShouldConstructFromSystemColor
public void ShouldConstructFromSystemColor()
{
var source = System.Drawing.Color.FromArgb(5, 10, 15);
var coloreColor = new Color(source);
Assert.AreEqual(source.R, coloreColor.R);
Assert.AreEqual(source.G, coloreColor.G);
Assert.AreEqual(source.B, coloreColor.B);
}
示例7: ShouldConstructFromRgb
public void ShouldConstructFromRgb()
{
var expected = new Color(0x123456);
var actual = Color.FromRgb(0x563412);
Assert.AreEqual(expected.Value, actual.Value);
Assert.AreEqual(expected.R, actual.R);
Assert.AreEqual(expected.G, actual.G);
Assert.AreEqual(expected.B, actual.B);
}
示例8: ShouldConvertRgbBytesCorrectly
public void ShouldConvertRgbBytesCorrectly()
{
const uint V = 0x00FFFFFF;
const byte R = 255;
const byte G = 255;
const byte B = 255;
var c = new Color(R, G, B);
Assert.AreEqual(c.Value, V);
Assert.AreEqual(c.R, R);
Assert.AreEqual(c.G, G);
Assert.AreEqual(c.B, B);
}
示例9: ShouldConvertRgbDoublesCorrectly
public void ShouldConvertRgbDoublesCorrectly()
{
const uint V = 0x00FFFFFF;
const double R = 1.0;
const double G = 1.0;
const double B = 1.0;
const byte Expected = 255;
var c = new Color(R, G, B);
Assert.AreEqual(c.Value, V);
Assert.AreEqual(c.R, Expected);
Assert.AreEqual(c.G, Expected);
Assert.AreEqual(c.B, Expected);
}
示例10: getNewColor
private Color getNewColor(Color color)
{
var magicNumber = 255;
var darkenedColor = darkenColor((int)red, (int)green, (int)blue);
red = darkenedColor[0];
green = darkenedColor[1];
blue = darkenedColor[2];
//temporarily not touching alpha, as it doesn't work at all.
//Yet.
alpha = color.A;
return new Color(red / magicNumber, green / magicNumber, blue / magicNumber, alpha);
}
示例11: ShouldConvertRgbBytesCorrectly
public void ShouldConvertRgbBytesCorrectly()
{
const uint V = 0x8056F5C8;
const byte R = 200;
const byte G = 245;
const byte B = 86;
const byte A = 128;
var c = new Color(R, G, B, A);
Assert.AreEqual(c.Value, V);
Assert.AreEqual(c.R, R);
Assert.AreEqual(c.G, G);
Assert.AreEqual(c.B, B);
Assert.AreEqual(c.A, A);
}
示例12: ShouldConvertRgbDoublesCorrectly
public void ShouldConvertRgbDoublesCorrectly()
{
const uint V = 0x7F3D89CC;
const double R = 0.8;
const double G = 0.54;
const double B = 0.24;
const double A = 0.5;
const byte ExpectedR = (byte)(R * 255);
const byte ExpectedG = (byte)(G * 255);
const byte ExpectedB = (byte)(B * 255);
const byte ExpectedA = (byte)(A * 255);
var c = new Color(R, G, B, A);
Assert.AreEqual(c.Value, V);
Assert.AreEqual(c.R, ExpectedR);
Assert.AreEqual(c.G, ExpectedG);
Assert.AreEqual(c.B, ExpectedB);
Assert.AreEqual(c.A, ExpectedA);
}
示例13: Breathing
/// <summary>
/// Initializes a new instance of the <see cref="Breathing" /> struct using
/// the <see cref="BreathingType.Two" /> breathing type.
/// </summary>
/// <param name="first">Initial color.</param>
/// <param name="second">Second color.</param>
public Breathing(Color first, Color second)
: this(BreathingType.Two, first, second)
{
}
示例14: Breathing
/// <summary>
/// Initializes a new instance of the <see cref="Breathing" /> struct.
/// </summary>
/// <param name="color">The color to set.</param>
public Breathing(Color color)
{
Color = color;
}
示例15: Static
/// <summary>
/// Initializes a new instance of the <see cref="Static" /> struct.
/// </summary>
/// <param name="color">Color to set.</param>
public Static(Color color)
{
Color = color;
}