none
How does the Lum value come out and you only know the percentage of brightness like # 5b9bd5 about ForegroundColor class RRS feed

  • Question

  • How does the Lum value come out and you only know the percentage of brightness like # 5b9bd5 about ForegroundColor class
    Friday, July 14, 2017 3:35 AM

All replies

  • Hi JellenM,

    Specifies the tint value applied to the color.
    
    If tint is supplied, then it is applied to the RGB value of the color to determine the final color applied.
    
    The tint value is stored as a double from -1.0 .. 1.0, where -1.0 means 100% darken and 1.0 means 100% lighten. Also, 0.0 means no change.
    
    In loading the RGB value, it is converted to HLS where HLS values are (0..HLSMAX), where HLSMAX is currently 255.
    
    [Example: 
    
    Here are some examples of how to apply tint to color:
    
    If (tint < 0)
    
    Lum’ = Lum * (1.0 + tint)
    
    For example: Lum = 200; tint = -0.5; Darken 50%
    
    Lum‘ = 200 * (0.5) => 100
    
    For example: Lum = 200; tint = -1.0; Darken 100% (make black)
    
    Lum‘ = 200 * (1.0-1.0) => 0
    
    If (tint > 0)
    
    Lum‘ = Lum * (1.0-tint) + (HLSMAX – HLSMAX * (1.0-tint))
    
    For example: Lum = 100; tint = 0.75; Lighten 75%
    
    Lum‘ = 100 * (1-.75) + (HLSMAX – HLSMAX*(1-.75))
    
    = 100 * .25 + (255 – 255 * .25)
    
    = 25 + (255 – 63) = 25 + 192 = 217
    
    For example: Lum = 100; tint = 1.0; Lighten 100% (make white)
    
    Lum‘ = 100 * (1-1) + (HLSMAX – HLSMAX*(1-1))
    
    = 100 * 0 + (255 – 255 * 0)
    
    = 0 + (255 – 0) = 255
    
    end example]
    
    The possible values for this attribute are defined by the W3C XML Schema double datatype.
    

    Reference:

    ForegroundColor Class

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 17, 2017 2:07 AM
    Moderator