Terminal-Icons icon indicating copy to clipboard operation
Terminal-Icons copied to clipboard

Add zero prefix to individual rgb values so length of each values is always 2

Open schmjop opened this issue 9 months ago • 0 comments

Description

Improve conversion from base 10 to base 16.

Related Issue

Motivation and Context

When converting rgb values <= 15 to hex, they only have a length of 1. E.g. "15 -> F". This commit adds a prefix 0 for hex values with a length of 1.

How Has This Been Tested?

Testing different input values and and checking the output that is returned.

Screenshots (if appropriate):

Types of changes

  • [x] 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 change)

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [ ] I have read the CONTRIBUTING document.
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

schmjop avatar May 13 '24 08:05 schmjop