Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
hyperPad

hyperPad Forum

  1. Home
  2. Help and Support
  3. Store and Modify a Colour with Code: Possible? How?

Store and Modify a Colour with Code: Possible? How?

Scheduled Pinned Locked Moved Help and Support
31 Posts 5 Posters 6.2k Views 3 Watching
  • 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.
  • D Offline
    D Offline
    Deeeds
    wrote on last edited by
    #1

    Is it possible to store (perhaps in a box container, array or other storage device) a colour, and then, when necessary, apply mathematics calculations to it, and change it, then apply it to objects?

    Aidan_FireA 1 Reply Last reply
    0
    • D Deeeds

      Is it possible to store (perhaps in a box container, array or other storage device) a colour, and then, when necessary, apply mathematics calculations to it, and change it, then apply it to objects?

      Aidan_FireA Offline
      Aidan_FireA Offline
      Aidan_Fire
      wrote on last edited by
      #2

      @Deeeds Yes, but the problem is it’s hex colour, so doing maths with it won’t be easy.

      1 Reply Last reply
      0
      • Aidan_FireA Offline
        Aidan_FireA Offline
        Aidan_Fire
        wrote on last edited by Aidan_Fire
        #3

        You do it pretty much the same way you modify any input field.
        0_1514867855172_94F25B15-8321-40D3-B2C3-8190A9E430A9.png
        As for doing maths with it, ask @Jack8680 he already has a project somewhere for converting hex code into decimal numbers. Or you could try find his project on the Hub.

        1 Reply Last reply
        1
        • T Offline
          T Offline
          Thecheater887
          wrote on last edited by
          #4

          I tried this.

          It didn’t work well.

          Let me know if any of yalls comes across a decent way to do so.

          Aidan_FireA 1 Reply Last reply
          1
          • T Thecheater887

            I tried this.

            It didn’t work well.

            Let me know if any of yalls comes across a decent way to do so.

            Aidan_FireA Offline
            Aidan_FireA Offline
            Aidan_Fire
            wrote on last edited by
            #5

            @Thecheater887 Tried what? What went wrong?

            T 1 Reply Last reply
            0
            • Aidan_FireA Aidan_Fire

              @Thecheater887 Tried what? What went wrong?

              T Offline
              T Offline
              Thecheater887
              wrote on last edited by
              #6

              @Aidan-Oxley Forming and using a color.

              I start with “#” stored in a box container.

              I then generate 6 random numbers and append them to the box container, so it should read like “#1F390C” thus far. I then append FF for 100% opacity.

              Output that to a change color, and my logic all the sudden doesn’t run by it, when with a standard-typed #FFFFFFFF or anything else functions normally.

              Michael KhalfinG Jack de WildeJ 2 Replies Last reply
              1
              • T Thecheater887

                @Aidan-Oxley Forming and using a color.

                I start with “#” stored in a box container.

                I then generate 6 random numbers and append them to the box container, so it should read like “#1F390C” thus far. I then append FF for 100% opacity.

                Output that to a change color, and my logic all the sudden doesn’t run by it, when with a standard-typed #FFFFFFFF or anything else functions normally.

                Michael KhalfinG Offline
                Michael KhalfinG Offline
                Michael Khalfin
                wrote on last edited by
                #7

                @Thecheater887 Can you please provide a link?

                Otherwise, try debugging. Make a label, and after each behavior make sure the hex code is proper. Also make sure each behavior is being triggered.

                D 1 Reply Last reply
                0
                • Michael KhalfinG Michael Khalfin

                  @Thecheater887 Can you please provide a link?

                  Otherwise, try debugging. Make a label, and after each behavior make sure the hex code is proper. Also make sure each behavior is being triggered.

                  D Offline
                  D Offline
                  Deeeds
                  wrote on last edited by
                  #8

                  @GameCRAZY

                  Read this sentence more carefully:

                  Output that to a change color, and my logic all the sudden doesn’t run by it, when with a standard-typed #FFFFFFFF or anything else functions normally.

                  He's already debugged it and isolated the problem to the conversion of a Box Container's storage to a Set Colour's capacity to receive what's stored. This is, most likely, due to mismatched data types. The Box Container has probably stored a String (almost certainly) from his modifications (appends are probably defaulting to being done as strings) whilst the Set Colour is imagining it's going to receive a hexadecimal data type.

                  For some reason, Box Containers seem to be storing a hexadecimal when manually entering #FFFFFFFF. That's why this weird. This has been partially considered. But not wholly. Features that could/should have been there include dynamic RGB/HSL entry/modifications possible in code, too, and an easy way to alter opacity levels dynamically, too, in isolation from all other aspects of a colour. Hue shifting would be enormously assistive, in its own right, for all manner of effects and level articulation.

                  Michael KhalfinG 1 Reply Last reply
                  0
                  • Aidan_FireA Offline
                    Aidan_FireA Offline
                    Aidan_Fire
                    wrote on last edited by
                    #9

                    Look through Jack8680’s Hub projects, he has a working colour manipulator.

                    D 1 Reply Last reply
                    0
                    • Aidan_FireA Aidan_Fire

                      Look through Jack8680’s Hub projects, he has a working colour manipulator.

                      D Offline
                      D Offline
                      Deeeds
                      wrote on last edited by Deeeds
                      #10

                      @Aidan-Oxley Which doesn't address the problem.

                      There is no simple, elegant and/or nicely abstracted way to store, edit and utilise dynamic colours.

                      In a 2D game engine...

                      ...without Sprite Animations, Sprite Sequences, Bitmap fonts or other forms of frame based animation.

                      Aidan_FireA 1 Reply Last reply
                      0
                      • D Deeeds

                        @Aidan-Oxley Which doesn't address the problem.

                        There is no simple, elegant and/or nicely abstracted way to store, edit and utilise dynamic colours.

                        In a 2D game engine...

                        ...without Sprite Animations, Sprite Sequences, Bitmap fonts or other forms of frame based animation.

                        Aidan_FireA Offline
                        Aidan_FireA Offline
                        Aidan_Fire
                        wrote on last edited by Aidan_Fire
                        #11

                        @Deeeds Jack’s project converts a bunch of percentages into hexadecimal code and then sets an object (the entire background) to that colour. Unless hyperPad released an update that broke this, it proves you can store and manipulate colour codes and then set an object to the colour you want. EDIT: Oh, you meant simple and elegant (missed a few words read too fast), yeah not too simple needs a bunch of maths I think.

                        D 1 Reply Last reply
                        0
                        • Aidan_FireA Aidan_Fire

                          @Deeeds Jack’s project converts a bunch of percentages into hexadecimal code and then sets an object (the entire background) to that colour. Unless hyperPad released an update that broke this, it proves you can store and manipulate colour codes and then set an object to the colour you want. EDIT: Oh, you meant simple and elegant (missed a few words read too fast), yeah not too simple needs a bunch of maths I think.

                          D Offline
                          D Offline
                          Deeeds
                          wrote on last edited by
                          #12

                          @Aidan-Oxley fixed... see above ^

                          Aidan_FireA 1 Reply Last reply
                          0
                          • D Deeeds

                            @Aidan-Oxley fixed... see above ^

                            Aidan_FireA Offline
                            Aidan_FireA Offline
                            Aidan_Fire
                            wrote on last edited by
                            #13

                            @Deeeds So what you really want then is hyperPad to be able to do maths in hexadecimal then? And convert bases?

                            D 1 Reply Last reply
                            0
                            • Aidan_FireA Aidan_Fire

                              @Deeeds So what you really want then is hyperPad to be able to do maths in hexadecimal then? And convert bases?

                              D Offline
                              D Offline
                              Deeeds
                              wrote on last edited by
                              #14

                              @Aidan-Oxley

                              No.

                              I want an easy, elegant, simple and nicely abstracted way to dynamically adjust colours and alpha.

                              Saturation, Hue, Brightness and Alpha should be separable and operable upon independently. That's part of being NICE and abstracted. etc...

                              1 Reply Last reply
                              0
                              • D Deeeds

                                @GameCRAZY

                                Read this sentence more carefully:

                                Output that to a change color, and my logic all the sudden doesn’t run by it, when with a standard-typed #FFFFFFFF or anything else functions normally.

                                He's already debugged it and isolated the problem to the conversion of a Box Container's storage to a Set Colour's capacity to receive what's stored. This is, most likely, due to mismatched data types. The Box Container has probably stored a String (almost certainly) from his modifications (appends are probably defaulting to being done as strings) whilst the Set Colour is imagining it's going to receive a hexadecimal data type.

                                For some reason, Box Containers seem to be storing a hexadecimal when manually entering #FFFFFFFF. That's why this weird. This has been partially considered. But not wholly. Features that could/should have been there include dynamic RGB/HSL entry/modifications possible in code, too, and an easy way to alter opacity levels dynamically, too, in isolation from all other aspects of a colour. Hue shifting would be enormously assistive, in its own right, for all manner of effects and level articulation.

                                Michael KhalfinG Offline
                                Michael KhalfinG Offline
                                Michael Khalfin
                                wrote on last edited by
                                #15

                                @Deeeds You can still output that string to a label!

                                D 1 Reply Last reply
                                0
                                • Michael KhalfinG Michael Khalfin

                                  @Deeeds You can still output that string to a label!

                                  D Offline
                                  D Offline
                                  Deeeds
                                  wrote on last edited by
                                  #16

                                  @GameCRAZY Labels aren't much use to the process of modifying a colour.

                                  Michael KhalfinG 1 Reply Last reply
                                  0
                                  • D Deeeds

                                    @GameCRAZY Labels aren't much use to the process of modifying a colour.

                                    Michael KhalfinG Offline
                                    Michael KhalfinG Offline
                                    Michael Khalfin
                                    wrote on last edited by
                                    #17

                                    @Deeeds Just check WHAT the string is, and work with that information!

                                    D 1 Reply Last reply
                                    0
                                    • Michael KhalfinG Michael Khalfin

                                      @Deeeds Just check WHAT the string is, and work with that information!

                                      D Offline
                                      D Offline
                                      Deeeds
                                      wrote on last edited by
                                      #18

                                      @GameCRAZY IT IS A STRING!!!

                                      That IS the problem.

                                      D 1 Reply Last reply
                                      0
                                      • D Deeeds

                                        @GameCRAZY IT IS A STRING!!!

                                        That IS the problem.

                                        D Offline
                                        D Offline
                                        Deeeds
                                        wrote on last edited by
                                        #19

                                        @GameCRAZY do you know what I mean if I say "different data types?"

                                        Michael KhalfinG 1 Reply Last reply
                                        0
                                        • D Deeeds

                                          @GameCRAZY do you know what I mean if I say "different data types?"

                                          Michael KhalfinG Offline
                                          Michael KhalfinG Offline
                                          Michael Khalfin
                                          wrote on last edited by
                                          #20

                                          @Deeeds Yes, but you can still work with strings. I do know some Swift.

                                          D 1 Reply Last reply
                                          0

                                          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                          With your input, this post could be even better 💗

                                          Register Login
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Search