There is no built-in "lighten" function in CSS, as it is typically associated with Less or Sass. However, there are JavaScript functions available online for achieving this effect, such as this one on css.trick
UPDATE Important! (change the function)
/**Credits to: https://css-tricks.com/snippets/javascript/lighten-darken-color/ */
//amt from 0 to 100
lightenDarkenColor(col, amt) {
amt=256-Math.floor(amt*5.12)
const usePound = col[0]=="#";
if (usePound)
col = col.slice(1);
const num = parseInt(col,16);
const rr=(num >> 16) + amt;
const bb = ((num >> 8) & 0x00FF) + amt;
const gg = (num & 0x0000FF) + amt;
const r=rr>255?255:rr<0?0:rr;
const b=bb>255?255:bb<0?0:bb;
const g=gg>255?255:gg<0?0:gg;
if ((g | (b << 8) | (r << 16))==0)
return "#000000";
return (usePound?"#":"") + (g | (b << 8) | (r << 16)).toString(16);
}
Use
<div [ngStyle]="{color: color, 'background-color': lightenDarkenColor(color, 10)}">hello word</div>
<div [ngStyle]="{color: color, 'background-color': lightenDarkenColor(color, 90)}">hello word</div>
see demo in stackblitz