Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Color constant to/from string?

    Beginners
    3
    12
    391
    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.
    • xevdev
      xevdev F last edited by

      Print(red)
      Will show you the vector rgba
      Red 1.000
      Green 0.000
      Blue 0.000
      Alpha 1.000 transparency
      I don't think you can go the other way unless you made your own list and put it in a function

      1 Reply Last reply Reply Quote 0
      • vinicity
        vinicity F last edited by vinicity

        Thanks.

        I was more looking for something like

        Print(convertToStr(red))
        

        which would give me the output:
        red

        and then something like

        Print(convertToColor("red"))
        

        which would output something like:
        1.0000, 0.0000, 0.0000, 0.0000

        (...that is the color rgba vector for red).

        pianofire 1 Reply Last reply Reply Quote 0
        • xevdev
          xevdev F last edited by

          How many colors ?

          1 Reply Last reply Reply Quote 0
          • pianofire
            pianofire Fuze Team @vinicity last edited by

            @vinicity I don't think there is a way currently. Leave it with me and I'll see if I can do a user function

            vinicity 1 Reply Last reply Reply Quote 1
            • xevdev
              xevdev F last edited by

              You might run into trouble just looked at the color section and thought
              Maroon
              Darkred
              And burgundy looked pretty similar
              Tried all three and burgundy doesn't exist
              It looks like they've named about a hundred colors out of a possible (2 to the power 24)

              1 Reply Last reply Reply Quote 0
              • pianofire
                pianofire Fuze Team last edited by

                Yes this will only work for colo(u)rs with defined constants. I think burgundy was a typo it is in as burgandy

                1 Reply Last reply Reply Quote 1
                • xevdev
                  xevdev F last edited by

                  Burgandy doesn't work either

                  1 Reply Last reply Reply Quote 0
                  • pianofire
                    pianofire Fuze Team last edited by

                    It is not syntax highlighting but it is displaying OK:

                    loop
                      clear(burgandy)
                      update()
                    repeat
                    
                    1 Reply Last reply Reply Quote 1
                    • vinicity
                      vinicity F @pianofire last edited by

                      @pianofire Thanks!

                      pianofire 1 Reply Last reply Reply Quote 0
                      • pianofire
                        pianofire Fuze Team @vinicity last edited by

                        @vinicity Here you go try this: https://fuzearena.com/forum/topic/957/functions-to-convert-from-a-string-to-a-colour-constant-and-vice-versa

                        Let me know if you find any problems

                        vinicity 1 Reply Last reply Reply Quote 2
                        • vinicity
                          vinicity F @pianofire last edited by

                          @pianofire Thanks a lot! Exactly what I needed!

                          1 Reply Last reply Reply Quote 1
                          • First post
                            Last post