Search Results for

    Show / Hide Table of Contents

    Class TransformationTools

    Color transformation tools

    Inheritance
    object
    TransformationTools
    Namespace: Terminaux.Colors.Transformation
    Assembly: Terminaux.dll
    Syntax
    public static class TransformationTools

    Methods

    | Edit this page View Source

    BlendColor((int r, int g, int b), (int r, int g, int b), double)

    Blends the two colors together

    Declaration
    public static Color BlendColor((int r, int g, int b) source, (int r, int g, int b) target, double factor = 0.5)
    Parameters
    Type Name Description
    (int R, int G, int B) source

    Source RGB levels to be blended

    (int R, int G, int B) target

    Target RGB levels to blend

    double factor

    Blending factor [0.0 to 1.0]

    Returns
    Type Description
    Color

    A color instance that represents a source color blended with the target color.

    | Edit this page View Source

    BlendColor(Color, Color, double)

    Blends the two colors together

    Declaration
    public static Color BlendColor(Color source, Color target, double factor = 0.5)
    Parameters
    Type Name Description
    Color source

    Source color to be blended

    Color target

    Target color to blend

    double factor

    Blending factor [0.0 to 1.0]

    Returns
    Type Description
    Color

    A color instance that represents a source color blended with the target color.

    | Edit this page View Source

    BlendColor(RedGreenBlue, RedGreenBlue, double)

    Blends the two colors together

    Declaration
    public static Color BlendColor(RedGreenBlue source, RedGreenBlue target, double factor = 0.5)
    Parameters
    Type Name Description
    RedGreenBlue source

    Source color to be blended

    RedGreenBlue target

    Target color to blend

    double factor

    Blending factor [0.0 to 1.0]

    Returns
    Type Description
    Color

    A color instance that represents a source color blended with the target color.

    | Edit this page View Source

    Complement(Color)

    Gets the color complement

    Declaration
    public static Color Complement(Color source)
    Parameters
    Type Name Description
    Color source

    Source color to get its complement

    Returns
    Type Description
    Color

    Complement color

    | Edit this page View Source

    Darken(Color, int)

    Darkens the color using the darkening factor

    Declaration
    public static Color Darken(Color source, int target)
    Parameters
    Type Name Description
    Color source

    Source color to darken

    int target

    Target darkening level from 0 to 100

    Returns
    Type Description
    Color

    Darkened color

    | Edit this page View Source

    Desaturate(Color, int)

    Desaturates the color using the desaturation factor

    Declaration
    public static Color Desaturate(Color source, int target)
    Parameters
    Type Name Description
    Color source

    Source color to desaturate

    int target

    Target desaturation level from 0 to 100

    Returns
    Type Description
    Color

    Desaturated color

    | Edit this page View Source

    GetContrast(Color, Color)

    Gets the contrast between two colors

    Declaration
    public static double GetContrast(Color firstColor, Color secondColor)
    Parameters
    Type Name Description
    Color firstColor

    First color (usually foreground)

    Color secondColor

    Second color (usually background)

    Returns
    Type Description
    double

    Contrast ratio

    | Edit this page View Source

    GetDarkBackground(Color)

    Gets the colorized dark background from the source color

    Declaration
    public static Color GetDarkBackground(Color source)
    Parameters
    Type Name Description
    Color source

    Source color to darken

    Returns
    Type Description
    Color

    A copy of the source color with darkness applied that suits the background

    | Edit this page View Source

    GetLightBackground(Color)

    Gets the colorized light background from the source color

    Declaration
    public static Color GetLightBackground(Color source)
    Parameters
    Type Name Description
    Color source

    Source color to lighten

    Returns
    Type Description
    Color

    A copy of the source color with lightness applied that suits the background

    | Edit this page View Source

    GetLuminance(double, double, double, bool)

    Gets the luminance of the color

    Declaration
    public static double GetLuminance(double r, double g, double b, bool sRgb = false)
    Parameters
    Type Name Description
    double r

    Red RGB color level (linear)

    double g

    Green RGB color level (linear)

    double b

    Blue RGB color level (linear)

    bool sRgb

    Convert linear RGB result to sRGB

    Returns
    Type Description
    double

    Luminance level in linear RGB or sRGB

    | Edit this page View Source

    GetLuminance(int, int, int, bool)

    Gets the luminance of the color

    Declaration
    public static double GetLuminance(int r, int g, int b, bool sRgb = false)
    Parameters
    Type Name Description
    int r

    Red RGB color level (sRGB)

    int g

    Green RGB color level (sRGB)

    int b

    Blue RGB color level (sRGB)

    bool sRgb

    Convert linear RGB result to sRGB

    Returns
    Type Description
    double

    Luminance level in linear RGB or sRGB

    | Edit this page View Source

    GetLuminance(Color, bool)

    Gets the luminance of the color

    Declaration
    public static double GetLuminance(Color color, bool sRgb = false)
    Parameters
    Type Name Description
    Color color

    Color to obtain luminance from

    bool sRgb

    Convert linear RGB result to sRGB

    Returns
    Type Description
    double

    Luminance level in linear RGB or sRGB

    | Edit this page View Source

    GetLuminance(RedGreenBlue, bool)

    Gets the luminance of the color

    Declaration
    public static double GetLuminance(RedGreenBlue rgb, bool sRgb = false)
    Parameters
    Type Name Description
    RedGreenBlue rgb

    RGB levels to obtain luminance from

    bool sRgb

    Convert linear RGB result to sRGB

    Returns
    Type Description
    double

    Luminance level in linear RGB or sRGB

    | Edit this page View Source

    Lighten(Color, int)

    Lightens the color using the lightening factor

    Declaration
    public static Color Lighten(Color source, int target)
    Parameters
    Type Name Description
    Color source

    Source color to lighten

    int target

    Target lightening level from 0 to 100

    Returns
    Type Description
    Color

    Lightened color

    | Edit this page View Source

    LinearRGBTosRGB(double)

    Converts from Linear RGB to sRGB using a linear RGB number

    Declaration
    public static int LinearRGBTosRGB(double linear)
    Parameters
    Type Name Description
    double linear

    Linear RGB number from 0 to 1

    Returns
    Type Description
    int

    sRGB value from 0 to 255

    | Edit this page View Source

    SRGBToLinearRGB(int)

    Converts from sRGB to Linear RGB using a color number

    Declaration
    public static double SRGBToLinearRGB(int colorNum)
    Parameters
    Type Name Description
    int colorNum

    Color number from 0 to 255

    Returns
    Type Description
    double

    Linear RGB number ranging from 0 to 1

    | Edit this page View Source

    Saturate(Color, int)

    Saturates the color using the saturation factor

    Declaration
    public static Color Saturate(Color source, int target)
    Parameters
    Type Name Description
    Color source

    Source color to saturate

    int target

    Target saturation level from 0 to 100

    Returns
    Type Description
    Color

    Saturated color

    | Edit this page View Source

    Spin(Color, int)

    Spins the color

    Declaration
    public static Color Spin(Color source, int target)
    Parameters
    Type Name Description
    Color source

    Source color to spin

    int target

    Spin angle

    Returns
    Type Description
    Color

    Spinned color

    • Edit this page
    • View Source
    In this article
    Back to top Generated by DocFX