Convert RGB value to Hex: Difference between revisions
Jump to navigation
Jump to search
(New page: <pre> #!/usr/bin/env python # File:rgb2hex.py # simple utility to convert rgb values to hex # within Scribus import scribus colorN = 255 while colorN != 0: color = scribus.valueDia...) |
No edit summary |
||
Line 1: | Line 1: | ||
This is a simple script that does one function: converts RGB decimal values to hex. As initially created, it will only do one value at a time. While it would be nice to allow this to remain open while you work with Scribus, this initial version will have to be closed to carry out any Scribus operations. | |||
====Usage==== | |||
* Start the script – there are no requirements other than running it from Scribus. One could certainly alter this to run outside of Scribus by eliminating the valueDialog and messageBox features. | |||
* Enter an RGB decimal value in the initial dialog. If you enter nothing, the value '255' is the default. | |||
* When you are finished, enter '0' (the number zero, not the letter O). | |||
<pre> | <pre> | ||
#!/usr/bin/env python | #!/usr/bin/env python |
Revision as of 13:59, 3 December 2008
This is a simple script that does one function: converts RGB decimal values to hex. As initially created, it will only do one value at a time. While it would be nice to allow this to remain open while you work with Scribus, this initial version will have to be closed to carry out any Scribus operations.
Usage
- Start the script – there are no requirements other than running it from Scribus. One could certainly alter this to run outside of Scribus by eliminating the valueDialog and messageBox features.
- Enter an RGB decimal value in the initial dialog. If you enter nothing, the value '255' is the default.
- When you are finished, enter '0' (the number zero, not the letter O).
#!/usr/bin/env python # File:rgb2hex.py # simple utility to convert rgb values to hex # within Scribus import scribus colorN = 255 while colorN != 0: color = scribus.valueDialog('Color Values','Enter the RGB value, 0 to quit') if color == '': color = '255' colorN = int(color) hexN = hex(colorN) result = scribus.messageBox ('Hex Value','RGB value of '+ color + ' is \n Hex value of '+ hexN,scribus.BUTTON_OK)