Created
September 27, 2019 11:43
-
-
Save NILID/b7e8fd3f72637e245091082a72ba7b09 to your computer and use it in GitHub Desktop.
Generate a random hex color, or with fixing anyone color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RandomColor | |
def self.get_random | |
rand(255) | |
end | |
def self.color_hex(options = {}) | |
default = { red: get_random, green: get_random, blue: get_random } | |
options = default.merge(options) | |
'#%X%X%X' % options.values | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
full random colour
freeze any color