Fix a bug with saving a color that already existed

- issues #7
- there is now a global hex and rgb variable
- code re-organization (including renaming a few functions)
- code optimizations