Less for name color to specific user

1589278017107.png

It is enough to add such code to extra.less.
Less:
.username-user-id (@userId; @color; @sh-color: false) {
    [class^="username"] {
        .username[data-user-id="@{userId}"] & {
            color: @color;
            & when (iscolor(@sh-color)) {
                text-shadow: @sh-color 2px 2px 10px;
            }
        }
    }
}

// Users who change nickname color
.username-user-id (1, #093, #093);
Now let's look at an example of a ready-made code, how can we change the nickname color for a specific user.
Everything is quite simple, we do not need to duplicate this whole large section of code, just one line is enough.
.username-user-id (@userId; @color; @ sh-color: false); is a variable that takes three parameters, separated by semicolons.
  • User ID - @userId;
  • Text color (name) - @color;
  • Text shadow color (name) - @sh-color; this parameter is optional
In our example, this.
  • User ID - 1
  • Text color (name) - #093
  • Text shadow color (name) - #093
Let's say we need to change the nickname color to another user.
Just duplicate this line: .username-user-id (1, # 093, # 093);
Under the existing one.
And a little change for a new user, for example like this: .username-user-id (2, # 063, # 063);
 
Back
Top