Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
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
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 2D Blocks
  4. The Color-Picker Widget

The Color-Picker Widget

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 862 Views
  • 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.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

     

    Prerequisite

    • The Label Widget

     

    Description

    You can use a color-picker to allow the user select a color (including transparency value), then you can use this color value in other blocks.

     

    Adding a Color-Picker

     

    Parameters

    • Center Position: The x and y positions of the center point of the color-picker.
    • Color-Picker Name: A unique name to refer to this color-picker later.

     

    Using the Color-Picker

    You can open or close the color-picker by clicking the round button. You can also close the color-picker by clicking anywhere outside the color picker window.

    You can pick a color by clicking on the color palette directly, and check the preview window on the bottom right.

    You can also read or set the color values using the textboxes at the bottom. The Hex value is always shown on the left (more about that format below), and the other fields are for the RGBA or HSL format.

     

    Reading from a Color-Picker

    You can read the color value of a color-picker using this block:

     

    Parameters

    • Widget Name: You need to select the widget to read the value from. For a color-picker, its value is the color selected by the user.

     

    Value Format

    The format of the color value is 8-digit hex value “#RRGGBBAA”, such as “#3366ccff”. For example, the first 2 hex digits “RR” represent the red color component, between 0 and 255. Similarly, the “GG” digits represent the green color component, the “BB” digits represent the blue color component, and the “AA” digits represent the alpha component (ff means fully opaque and 00 means fully transparent).

     

    Handle the Change Event of a Color-Picker

    You can listen to the change event of a color-picker with this block:

     

    Parameters

    • Widget Name: You need to select the name of the color-picker to watch for value change events.

     

    Demo

    This example program draws some random lines whenever the color picker’s value changes. It uses the value of the color picker to set the color of the pen.

    pick.gif

    1 Reply Last reply
    0
    • CreatiCodeI CreatiCode pinned this topic on

    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

    • Don't have an account? Register

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