Table of Contents

THSLColor Structure

Implements a simple representation of a color in Hue/Saturation/Lum colorspace.

Syntax

Namespace: FlexCel.Core

public struct THSLColor

Constructors

Methods

Name Description
ToColor Returns a system color from this instance. This method is only needed in Visual Basic, in C# you can just assign the HslColor to the Color:...[more]
ApplyTint This method returns the brightness that results from applying tint to brightness.
GetTint Returns the tint needed to go from originalBrightness to newBrightness.
A tint of 0 means no change (OriginalBrightness == NewBrightness), a tint of -1 means NewBrightness = 0, and a tint of 1 means NewBrightness = 1. So this method just does a simple interpolation to find out the needed tint.




This method is the inverse of ApplyTint
DistanceSquared Returns the distance between 2 colors. Not that this is not the euclidean distance, but a distance calculated to improve Hue matching.
When converting cell colors, we try to preserve hues, so even a very pale red cell will be converted to bright red and not white or a very pale blue.
This make it different from standard color matching as is done when adjusting images to a color palette, and where hue is not as important as here.
Equals Returns true if both colors are the same.
GetHashCode Returns a hashcode for the color.
CompareTo Returns -1 if obj is more than color, 0 if both colors are the same, and 1 if obj is less than color.

Operators

Name Description
Implicit Conversion Overloaded
Implicit conversion from TUIColor to THSLColor
Implicit conversion from THSLColor to TUIColor
Implicit conversion from Color to THSLColor
Implicit conversion from THSLColor to Color
Equality Returns true if both colors are equal.
Inequality Returns true if both colors do not have the same value.
GreaterThan Returns true if o1 is bigger than o2.
LessThan Returns true if o1 is less than o2.

Properties

Name Description
Hue Color hue. (between 0 and 360)
Sat Color Saturation. (between 0 and 1)
Lum Color brightness. (between 0 and 1)
R Red component in the RGB space.
G Green component in the RGB space.
B Blue component in the RGB space.
Empty Returns an empty color.