MCPcopy
hub / github.com/PySimpleGUI/PySimpleGUI / rgb

Function rgb

PySimpleGUI/PySimpleGUI.py:630–645  ·  view source on GitHub ↗

Given integer values of Red, Green, Blue, return a color string "#RRGGBB" :param red: Red portion from 0 to 255 :type red: (int) :param green: Green portion from 0 to 255 :type green: (int) :param blue: Blue portion from 0 to 255 :type blue: (int) :return:

(red, green, blue)

Source from the content-addressed store, hash-verified

628# One-liner functions that are handy as f_ck #
629# ====================================================================== #
630def rgb(red, green, blue):
631 """
632 Given integer values of Red, Green, Blue, return a color string "#RRGGBB"
633 :param red: Red portion from 0 to 255
634 :type red: (int)
635 :param green: Green portion from 0 to 255
636 :type green: (int)
637 :param blue: Blue portion from 0 to 255
638 :type blue: (int)
639 :return: A single RGB String in the format "#RRGGBB" where each pair is a hex number.
640 :rtype: (str)
641 """
642 red = min(int(red), 255) if red > 0 else 0
643 blue = min(int(blue), 255) if blue > 0 else 0
644 green = min(int(green), 255) if green > 0 else 0
645 return '#%02x%02x%02x' % (red, green, blue)
646
647
648# ====================================================================== #

Callers 4

__init__Method · 0.85
updateMethod · 0.85
__init__Method · 0.85
updateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected