Skip to content
This repository has been archived by the owner on Jul 29, 2019. It is now read-only.

How to add the color in in multiline lable #3384

Open
dnskmr opened this issue Aug 22, 2017 · 2 comments
Open

How to add the color in in multiline lable #3384

dnskmr opened this issue Aug 22, 2017 · 2 comments

Comments

@dnskmr
Copy link

dnskmr commented Aug 22, 2017

Hi Admin,

How to add the color for multi-line text in node and edges..
Ex:

{
  from:'Variant1',
  to:'Variant2',
  label: '<red>3306</red>\n3307\n3308',
  length:300,
  font: {align: 'bottom'},
  smooth: {
    type: "curvedCCW",
    roundness: 0.4
  }
},

I want to display the 3306 in red color,others black color

@wimrijnders
Copy link
Contributor

Html tag support is very limited, only <b>, <i> and <code> are supported.
Even so, the effect you want can be achieved by using one of these tags and adjusting the font for this tag. For example, for the <b> tag:

  var options = {
    nodes: {
      font: {
        multi: true,
        bold: {
          mod: '',
          color: '#ff0000'
        }
      }
    }

And then define your label as:

  label: '<b>3306</b>\n3307\n3308',

A quick test in the basicUsage example gives:

download

HTH.

@wimrijnders
Copy link
Contributor

Does this answer your question? If so, please close the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants