Is it possible to set text color (white or black) based on background (any color & color...

Discussão em 'Angular' iniciado por Kvasimodo, Outubro 31, 2024.

  1. Kvasimodo

    Kvasimodo Guest

    I need set text color based on background (text color should be black or white). Background in my app could have any color & color format. I was looking for a couple approaches, but for me non of them were perfect:

    1. mix-blend-mode (seems to me uncontrollable, I didn't come up with solution, where my conditions would be accomplished)

    [​IMG]


    1. filter() css (from my perspective works bad for text, I see pixels when highlight text) [​IMG]


    2. less function contrast (color: contrast(@backgroundColor, #000, #fff, 80%);) (it could be perfect solution, but I don't know how to update @backgroundColor, for some reason less.modifyvars doesn't work in my angular app (less in not defined) )


    3. js (I can't find angular lib which will be converting all official color formats to rgb. I need rgb to calculate what color use white or black)

    Continue reading...

Compartilhe esta Página