Skip to content

Add color to string usage example - #787

Open
Abod-A wants to merge 4 commits into
thoth-tech:mainfrom
Abod-A:add-color-to-string-usage-example
Open

Add color to string usage example#787
Abod-A wants to merge 4 commits into
thoth-tech:mainfrom
Abod-A:add-color-to-string-usage-example

Conversation

@Abod-A

@Abod-A Abod-A commented Jul 23, 2026

Copy link
Copy Markdown

Description

Adds a usage example for the color_to_string function in the color API category. The example draws five coloured rectangles (red, green, blue, orange, purple) and displays the hex string representation of each colour below its rectangle using color_to_string.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (update or new)

How Has This Been Tested?

Ran the example locally on macOS. Compiled and executed the C++ version using skm clang++ and verified the output window displayed all five rectangles with correct hex string values beneath each one.

Testing Checklist

  • Tested in latest Chrome
  • Tested in latest Firefox
  • npm run build
  • npm run preview

Checklist

Please delete options that are not relevant.

If involving code

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

If modified config files

  • I have checked the following files for changes:
    • package.json
    • astro.config.mjs
    • netlify.toml
    • docker-compose.yml
    • custom.css

Folders and Files Added/Modified

Please list the folders and files added/modified with this pull request and delete options that are not relevant.

  • Added:
    • public/usage-examples/color/color_to_string-1-example.cpp
    • public/usage-examples/color/color_to_string-1-example.py
    • public/usage-examples/color/color_to_string-1-example-top-level.cs
    • public/usage-examples/color/color_to_string-1-example-oop.cs
    • public/usage-examples/color/color_to_string-1-example.txt
    • public/usage-examples/color/color_to_string-1-example.png
  • Modified:
    • N/A

Additional Notes

The example uses five named SplashKit colours to clearly demonstrate how color_to_string converts a colour into its hex string format (#RRGGBBAA). A screenshot of the expected output is included.

@netlify

netlify Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploy Preview for splashkit failed.

Name Link
🔨 Latest commit 428b1ee
🔍 Latest deploy log https://app.netlify.com/projects/splashkit/deploys/6a61a0fdb537230008c2b468

@jankiluitel jankiluitel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Great work on this PR! The usage examples are well structured and consistent across C++, Python, and C# implementations. I especially liked that each example demonstrates a practical use case rather than just calling the function in isolation. The accompanying images/GIFs and description files make the examples much easier for new users to understand, and the code is clean, readable, and well commented.

One small suggestion would be to keep comments and terminology completely consistent across all language implementations where possible. For example, ensuring the function descriptions and wording match exactly between C++, Python, and C# would improve consistency for learners switching between languages. Other than that, I didn't notice any major issues, and the changes look ready for review. Great job!

Approved. The implementation is clear, consistent, and meets the expected documentation and usage example standards. Nice work!

@himanshigaba22 himanshigaba22 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.

This PR bundles four separate usage examples—alpha_of, color_to_string, move_mouse_to_point, and timer_started—but the PR title and description only refer to color_to_string. Could these be split into separate PRs, or alternatively could the title and description be updated to clearly reflect everything included? Keeping each PR focused would make review, testing, and any follow-up changes much easier to track.

A couple of specific points:

In the move_mouse_to_point example, the C++ and C# versions call move_mouse, while the Python version calls move_mouse_to_point. Could you please confirm whether these map to the same underlying function, such as an overload that Python exposes under a different name?
The testing section currently only mentions verifying the color_to_string example. Could you also confirm that the alpha_of, move_mouse_to_point, and timer_started examples were compiled or run successfully in their supported languages?

The examples themselves are clear and practical, but clarifying the PR scope and testing coverage would make the contribution easier to review and maintain.

@ralphweng2023 ralphweng2023 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.

Picking up the move_mouse question from himanshigaba22 since it has been sitting since the 26th: they are the same function. api.json lists move_mouse_to_point with a cpp signature of move_mouse(point_2d point) and a python one of move_mouse_to_point(point), so C++ overloads on the argument type while Python gives the point version its own name. Both files are calling it correctly.

The scope point still stands though. Four examples across three categories under a title naming only color_to_string is hard to follow, and updating the title and description rather than splitting the PR looks like the cheaper of the two options offered. Please do one or the other before this merges.

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