Sources/net.heutelbeck.streamdeck.fritz.sdPlugin/js/properties.js
/*
    Quick utility to lighten or darken a color (doesn't take color-drifting, etc. into account)
    Usage:
    fadeColor('#061261', 100); // will lighten the color
    fadeColor('#200867'), -100); // will darken the color
*/
Quick utility to lighten or darken a color (doesn't take color-drifting, etc.
Quick utility to lighten or darken a color ( doesn ' t take color - drifting etc .
function fadeColor (col, amt) {
    const min = Math.min, max = Math.max;
    const num = parseInt(col.replace(/#/g, ''), 16);
    const r = min(255, max((num >> 16) + amt, 0));
    const g = min(255, max((num & 0x0000FF) + amt, 0));
    const b = min(255, max(((num >> 8) & 0x00FF) + amt, 0));
    return '#' + (g | (b << 8) | (r << 16)).toString(16).padStart(6, 0);
}
function fadeColor ( col , amt ) { const min = Math . min , max = Math . max ; const num = parseInt ( col . replace ( / # / g , '' ) , 16 ) ; const r = min ( 255 , max ( ( num >> 16 ) + amt , 0 ) ) ; const g = min ( 255 , max ( ( num & 0x0000FF ) + amt , 0 ) ) ; const b = min ( 255 , max ( ( ( num >> 8 ) & 0x00FF ) + amt , 0 ) ) ; return '#' + ( g | ( b << 8 ) | ( r << 16 ) ) . toString ( 16 ) . padStart ( 6 , 0 ) ; }
Quick utility to lighten or darken a color (doesn't take color-drifting, etc.
Quick utility to lighten or darken a color ( doesn ' t take color - drifting etc .