Jump to content
Korean Random
Konfus-ius

XVM String based coloring

Recommended Posts

Fellow Tankers,

 

after setting up my own xvm-configuration (based on the various great examples), one key ingredient is missing:

 

Coloring of player names in the panels with name-dependend colors.

 

I tried to define within colors.xc;

// Dynamic color by prominent player
    "name": [
      { "value": "Quickfingers",  	"color": "0xDD4444" },
      { "value": "piskinas",  		"color": "0xDD4444" },
      { "value": "SirFoch",  		"color": "0xDD4444" }
    ],

and also tried some HEX-representation of the names. But unfortunately, no coloring happend.

 

My question is: how to define the "values" in order to get a string-dependend coloring of player names. Is there any hope?

 

Thanks for your support,

 

Konfus-ius

Share this post


Link to post

Short link
Share on other sites

You can look through this thread to see how I assigned icons to players using XVM: https://koreanrandom.com/forum/topic/39687-help-with-definitions/

 

It is possible to use a similar method for colouring names, but I'm away from my PC for the next few days so maybe someone else from that thread will come along and help you too. :)

Share this post


Link to post

Short link
Share on other sites

One way to do it:

create new file "nick.xc" with the contents that define nickname alternative formatting

/**
 * This file is used to change players names in players panels to multi colored formats
 */
{
  "nick": {
    // Changing the names of nicknames for the macro {{.nick.name.{{name}}}}.
    "name": {
    "kupjones": "<font face='gunplay'>KupJones</font>",
//    "kupjones": "<font face='gunplay'><font color='#FE7903'>K</font><font color='#F8F400'>U</font><font color='#D042F3'>P</font><font color='#02C9B3'>J</font><font color='#60FF00'>O</font><font color='#FE0E00'>N</font><font color='#FE7903'>E</font><font color='#F8F400'>S</font></font>",    
    "sailorboy7982": "<font face='gunplay'>Sailorboy</font>",
    "playersname": ${"nick.name."}
    },
    
    // color your clan nick {{.nick.clan.{{clan}}}}.
    "clan": {
      "[SOGG]": "<font face='$TitleFont' color='#02C9B3'>[TEST]</font>"
    }

  }
}

 

 

Add to "xvm.xc" boot file

  //create new nicknames
  "nick": ${"nick.xc":"nick"},

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites
5 hours ago, Konfus-ius said:

Fellow Tankers,

 

after setting up my own xvm-configuration (based on the various great examples), one key ingredient is missing:

 

Coloring of player names in the panels with name-dependend colors.

 

I tried to define within colors.xc;


// Dynamic color by prominent player
    "name": [
      { "value": "Quickfingers",  	"color": "0xDD4444" },
      { "value": "piskinas",  		"color": "0xDD4444" },
      { "value": "SirFoch",  		"color": "0xDD4444" }
    ],

 

 

Untested... but should work.

Like this in colors.xc


// Dynamic color by prominent player

"name": {

"Quickfingers": "#DD4444", // or 0xDD4444 etc depending on what you are doing. HTML doesn't care too much for hex.

"piskinas": "#DD4444",

"SirFoch": "#DD4444"
},

 

And then you would call it like this if using HTML like you might in the PlayersPanel

 

<font color='{{.colors.name.{{name}}|{{c:wn8}}}}'>{{name}}</font> //Assuming you put "name" under "colors" in colors.xc


The |{{c:wn8}} is something to color any name that doesn't match your list. You can use whatever you want...

I also use the above mentioned nick.xc file. It works the same way as I just described.

Cheers!

 

Edited by SmashPuppet
addition

Share this post


Link to post

Short link
Share on other sites

Thanks SmashPuppet,

 

this exactly solved it. Great. Had for the meantime some issues with color definition (0x... vs #...).

 

Thanks for the support,

 

Konfus-ius

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...