Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript colour picker/changer

  • 20-03-2013 8:14pm
    #1
    Registered Users, Registered Users 2 Posts: 2,588 ✭✭✭


    So I've got a <canvas> element that I need the user to be able to change the colour of on the fly using some sort of slider or anything else, just the user has to be able to select the colour, so I can't just have it change randomly onclick.

    Any ideas on the best way to approach this?

    Or put another way:

    Help me make this work http://codepen.io/Shane24/pen/cEGsb

    I have this red box, I need to be able to change the colour of the box on the fly. Any tips?


    Edit: Found something that I can probably rework, but any help/suggestions still appreciated


    Further edit: Got it working! http://codepen.io/Shane24/pen/dGcHs


Comments

  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    Seeing as you are using canvas, this might get you some mileage.
    <input type="color"></input>
    


  • Registered Users, Registered Users 2 Posts: 2,588 ✭✭✭KonFusion


    Here's what I've got so far

    http://codepen.io/Shane24/pen/cEGsb

    So how the frick do I get those numbers in the input boxes (that you can change via the sliders) into a variable?


  • Registered Users, Registered Users 2 Posts: 11,989 ✭✭✭✭Giblet


    The slide event sets the textbox, but it can also set other things.

    Also, an onchange event could set a variable too.


  • Registered Users, Registered Users 2 Posts: 2,588 ✭✭✭KonFusion


    Got it working

    http://codepen.io/Shane24/pen/dGcHs

    I was executing code before the html was parsed, among other silly things.

    Now for some much needed sleepzzzzzzzzzzzzzz.......


Advertisement