HISE Logo Forum
    • Categories
    • Register
    • Login

    How to specify text color

    Scheduled Pinned Locked Moved Scripting
    3 Posts 3 Posters 37 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pcs800P
      pcs800
      last edited by

      I have a project which uses a certain shade of gold for text labels, which is #FFB7AA5B
      I created panels to display db meter scales, but cannot figure out how to specify a color other than just Colours.gold

      //Panel 1
      const var dBScalePanel1 = Content.addPanel("dBScale1", 20, 160);
      dBScalePanel1.set("width", 30);
      dBScalePanel1.set("height", panelHeight);
      
      dBScalePanel1.setPaintRoutine(function(g)
      {
          g.setColour(Colours.gold);
          g.setFont("Roboto", 10);
          var usableHeight = panelHeight - paddingTop - paddingBottom;
      
          for (i = 0; i < scaleValues.length; i++)
          {
              var y = (scaleValues[i] / -60.0) * usableHeight + paddingTop;
              g.drawAlignedText(scaleValues[i] + " dB", [0, y - 6, 40, 12], "left");
          }
      });
      
      1 Reply Last reply Reply Quote 0
      • dannytaurusD
        dannytaurus
        last edited by dannytaurus

        The docs on Colours are pretty comprehensive:

        Link Preview Image
        HISE | Scripting | Colours

        Generate and modify colours.

        favicon

        (docs.hise.dev)

        Meat Beats: https://meatbeats.com
        Klippr Video: https://klippr.video

        Christoph HartC 1 Reply Last reply Reply Quote 2
        • Christoph HartC
          Christoph Hart @dannytaurus
          last edited by

          "#FFB7AA5B" is a hex representation of a colour with the #AARRGGBB format. You're almost there, you just need to turn that into an actual number with the hex format:

          const var RED = 0xFFFF0000;
          const var GREEN = 0xFF00FF00; // same as #FF00FF00
          const var TRANSPARENT = 0; // shortcut for 0x00000000
          1 Reply Last reply Reply Quote 2
          • First post
            Last post

          32

          Online

          1.8k

          Users

          12.2k

          Topics

          106.1k

          Posts