Skip to content

Add HSB color usage example - #820

Open
Osaid2993 wants to merge 2 commits into
thoth-tech:mainfrom
Osaid2993:usage-example-hsb-color
Open

Add HSB color usage example#820
Osaid2993 wants to merge 2 commits into
thoth-tech:mainfrom
Osaid2993:usage-example-hsb-color

Conversation

@Osaid2993

Copy link
Copy Markdown

Description

Splashkit Function: hsb_color

Overview of example functionality:
This example demonstrates how hsb_color creates colors using hue, saturation, and brightness values. The user can interactively adjust each HSB component and immediately see the resulting color update on screen.

Example Output:
hsb_color-1-example

Files Included

  • C++ code
  • C# code (Top-Level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • Relevant title for the example (.txt)
  • Screenshot

Usage Example Checks (READ CAREFULLY)

  • Code uses Splashkit function above
  • Code does not use non-Splashkit functions
  • Code does not use extra function declarations or extra classes
  • Code does not violate any of the Thoth Tech SplashKit Style Guide rules
  • Simple, clear demonstration of the function
  • Tested in Chrome and Firefox

@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 260aefa
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a812a7298a0370008073d96

@ekam313 ekam313 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The example runs well across all four language versions, and the HSB interaction works as expected. I found a few consistency/style points that could be improved before approval:

The value-clamping logic is implemented differently across the languages. C++ uses if statements, C# uses Math.Clamp, and Python uses max/min. Since usage examples should maintain a similar structure across languages and remain easy for beginners to compare, could this logic be made consistent across all versions?

The code files currently have no comments. A few short, consistent comments for the main logical sections, such as handling input, keeping HSB values within range, and displaying the generated colour, would improve readability for beginner users.

Apart from these points, the program functionality and interaction worked correctly during testing.

@Osaid2993

Copy link
Copy Markdown
Author

Appreciate the thorough review @ekam313.

For the comments, that's fair, I've added a few section comments to each version.

On the clamping consistency, I intentionally used each language's idiomatic approach. Math.Clamp is the standard way to do this in C#, and max/min is the natural Python pattern. Rewriting them all as if-statements would work, but it would make the C# and Python versions less representative of how you'd actually write that language. Since these examples are meant to teach SplashKit in the context of each language, I think showing the idiomatic approach is more useful than forcing identical structure.

Happy to hear your thoughts on that though.

@jasveena15

Copy link
Copy Markdown

Peer Review

I've reviewed PR #820, Add HSB Color Usage Example, against the SplashKit Usage Example requirements and style guide.

The example provides a clear and interactive demonstration of the hsb_color function by allowing users to adjust hue, saturation, and brightness values and immediately observe the resulting colour.

Checks

  • All required files are present.
  • Example Title (.txt)
  • C++ code
  • C# code (top-level statements)
  • C# code (Object-Oriented Programming)
  • Python code
  • GIF output
  • Code correctly uses SplashKit functions.
  • Code clearly demonstrates the hsb_color function.
  • All language versions maintain the same overall structure and behaviour.
  • Variable naming follows the required conventions for each language.
  • Comments are clear and consistent across the implementations.
  • C# top-level and OOP versions follow the appropriate SplashKit coding styles.
  • Python uses the appropriate Python-specific SplashKit function names.

Code Tests Done

  • C++ code compiled and ran correctly.
  • C# top-level code ran correctly.
  • C# OOP code ran correctly.
  • Python code ran correctly.
  • Keyboard controls correctly adjusted hue, saturation, and brightness.
  • HSB values remained within the expected range of 0 to 1.
  • The displayed colour updated correctly in response to user input.

Website Tests Done

  • Local website tested successfully using npm run dev.
  • Usage example displayed correctly under the relevant Color API function.
  • Code examples and output displayed correctly on the local website.

The implementation is clear, beginner-friendly, and provides a useful demonstration of how HSB colour values can be manipulated interactively.

Approved from my side.

@rachelpatrao rachelpatrao left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The hsb_color usage example clearly demonstrates how hue, saturation, and brightness can be adjusted interactively, and the output is easy to understand. Everything looks good from my side. Happy to approve!

@ekam313 ekam313 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good Approved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants