Search Results for

    Show / Hide Table of Contents

    Class ColorHelper

    Inheritance
    System.Object
    ColorHelper
    Namespace: IronPPT.Models.Extensions
    Assembly: IronPPT.dll
    Syntax
    public static class ColorHelper : Object

    A hex string for a color, ready to drop into a style or markup attribute, comes from ColorHelper. The static helper adds an extension method to Color so any color value in a presentation can be expressed in the #RRGGBB form a developer needs when serializing a fill, a font color, or a border.

    The single method is ToHex, called as an extension on a Color instance, returning the hex string for that color. Because it is an extension method, you call it directly on the color (myColor.ToHex()) rather than reaching for the helper type by name, which keeps color conversion inline where the color is already in hand. Use it whenever a slide style value needs a textual color rather than the structured Color object, for example when writing out a theme value or comparing two colors as strings.

    string hex = someColor.ToHex();

    The paragraph style example shows color applied to text, and the customized bullet point example styles a bullet, where a hex color is often handy.

    Methods

    ToHex(Color)

    Declaration
    public static string ToHex(this Color c)
    Parameters
    Type Name Description
    Color c
    Returns
    Type Description
    System.String
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet