How to use _colors method in autotest

Best Python code snippet using autotest_python

color.py

Source:color.py Github

copy

Full Screen

1import string2from java import awt, lang3from geoscript.style.expression import Expression4from geoscript import util5_colors = {}6_colors['aliceblue'] = awt.Color(240,248,255)7_colors['antiquewhite'] = awt.Color(250,235,215)8_colors['aqua'] = awt.Color(0,255,255)9_colors['aquamarine'] = awt.Color(127,255,212)10_colors['azure'] = awt.Color(240,255,255)11_colors['beige'] = awt.Color(245,245,220)12_colors['bisque'] = awt.Color(255,228,196)13_colors['black'] = awt.Color(0,0,0)14_colors['blanchedalmond'] = awt.Color(255,235,205)15_colors['blue'] = awt.Color(0,0,255)16_colors['blueviolet'] = awt.Color(138,43,226)17_colors['brown'] = awt.Color(165,42,42)18_colors['burlywood'] = awt.Color(222,184,135)19_colors['cadetblue'] = awt.Color(95,158,160)20_colors['chartreuse'] = awt.Color(127,255,0)21_colors['chocolate'] = awt.Color(210,105,30)22_colors['coral'] = awt.Color(255,127,80)23_colors['cornflowerblue'] = awt.Color(100,149,237)24_colors['cornsilk'] = awt.Color(255,248,220)25_colors['crimson'] = awt.Color(220,20,60)26_colors['cyan'] = awt.Color(0,255,255)27_colors['darkblue'] = awt.Color(0,0,139)28_colors['darkcyan'] = awt.Color(0,139,139)29_colors['darkgoldenrod'] = awt.Color(184,134,11)30_colors['darkgray'] = awt.Color(169,169,169)31_colors['darkgreen'] = awt.Color(0,100,0)32_colors['darkkhaki'] = awt.Color(189,183,107)33_colors['darkmagenta'] = awt.Color(139,0,139)34_colors['darkolivegreen'] = awt.Color(85,107,47)35_colors['darkorange'] = awt.Color(255,140,0)36_colors['darkorchid'] = awt.Color(153,50,204)37_colors['darkred'] = awt.Color(139,0,0)38_colors['darksalmon'] = awt.Color(233,150,122)39_colors['darkseagreen'] = awt.Color(143,188,143)40_colors['darkslateblue'] = awt.Color(72,61,139)41_colors['darkslategray'] = awt.Color(47,79,79)42_colors['darkturquoise'] = awt.Color(0,206,209)43_colors['darkviolet'] = awt.Color(148,0,211)44_colors['deeppink'] = awt.Color(255,20,147)45_colors['deepskyblue'] = awt.Color(0,191,255)46_colors['dimgray'] = awt.Color(105,105,105)47_colors['dodgerblue'] = awt.Color(30,144,255)48_colors['firebrick'] = awt.Color(178,34,34)49_colors['floralwhite'] = awt.Color(255,250,240)50_colors['forestgreen'] = awt.Color(34,139,34)51_colors['fuchsia'] = awt.Color(255,0,255)52_colors['gainsboro'] = awt.Color(220,220,220)53_colors['ghostwhite'] = awt.Color(248,248,255)54_colors['gold'] = awt.Color(255,215,0)55_colors['goldenrod'] = awt.Color(218,165,32)56_colors['gray'] = awt.Color(128,128,128)57_colors['green'] = awt.Color(0,128,0)58_colors['greenyellow'] = awt.Color(173,255,47)59_colors['grey'] = awt.Color(84,84,84)60_colors['honeydew'] = awt.Color(240,255,240)61_colors['hotpink'] = awt.Color(255,105,180)62_colors['indianred'] = awt.Color(205,92,92)63_colors['indigo'] = awt.Color(75,0,130)64_colors['ivory'] = awt.Color(255,255,240)65_colors['khaki'] = awt.Color(240,230,140)66_colors['lavender'] = awt.Color(230,230,250)67_colors['lavenderblush'] = awt.Color(255,240,245)68_colors['lawngreen'] = awt.Color(124,252,0)69_colors['lemonchiffon'] = awt.Color(255,250,205)70_colors['lightblue'] = awt.Color(173,216,230)71_colors['lightcoral'] = awt.Color(240,128,128)72_colors['lightcyan'] = awt.Color(224,255,255)73_colors['lightgoldenrodyellow'] = awt.Color(250,250,210)74_colors['lightgrey'] = awt.Color(211,211,211)75_colors['lightgreen'] = awt.Color(144,238,144)76_colors['lightpink'] = awt.Color(255,182,193)77_colors['lightsalmon'] = awt.Color(255,160,122)78_colors['lightseagreen'] = awt.Color(32,178,170)79_colors['lightskyblue'] = awt.Color(135,206,250)80_colors['lightslategray'] = awt.Color(119,136,153)81_colors['lightsteelblue'] = awt.Color(176,196,222)82_colors['lightyellow'] = awt.Color(255,255,224)83_colors['lime'] = awt.Color(0,255,0)84_colors['limegreen'] = awt.Color(50,205,50)85_colors['linen'] = awt.Color(250,240,230)86_colors['magenta'] = awt.Color(255,0,255)87_colors['maroon'] = awt.Color(128,0,0)88_colors['mediumaquamarine'] = awt.Color(102,205,170)89_colors['mediumblue'] = awt.Color(0,0,205)90_colors['mediumorchid'] = awt.Color(186,85,211)91_colors['mediumpurple'] = awt.Color(147,112,216)92_colors['mediumseagreen'] = awt.Color(60,179,113)93_colors['mediumslateblue'] = awt.Color(123,104,238)94_colors['mediumspringgreen'] = awt.Color(0,250,154)95_colors['mediumturquoise'] = awt.Color(72,209,204)96_colors['mediumvioletred'] = awt.Color(199,21,133)97_colors['midnightblue'] = awt.Color(25,25,112)98_colors['mintcream'] = awt.Color(245,255,250)99_colors['mistyrose'] = awt.Color(255,228,225)100_colors['moccasin'] = awt.Color(255,228,181)101_colors['navajowhite'] = awt.Color(255,222,173)102_colors['navy'] = awt.Color(0,0,128)103_colors['oldlace'] = awt.Color(253,245,230)104_colors['olive'] = awt.Color(128,128,0)105_colors['olivedrab'] = awt.Color(107,142,35)106_colors['orange'] = awt.Color(255,165,0)107_colors['orangered'] = awt.Color(255,69,0)108_colors['orchid'] = awt.Color(218,112,214)109_colors['palegoldenrod'] = awt.Color(238,232,170)110_colors['palegreen'] = awt.Color(152,251,152)111_colors['paleturquoise'] = awt.Color(175,238,238)112_colors['palevioletred'] = awt.Color(216,112,147)113_colors['papayawhip'] = awt.Color(255,239,213)114_colors['peachpuff'] = awt.Color(255,218,185)115_colors['peru'] = awt.Color(205,133,63)116_colors['pink'] = awt.Color(255,192,203)117_colors['plum'] = awt.Color(221,160,221)118_colors['powderblue'] = awt.Color(176,224,230)119_colors['purple'] = awt.Color(128,0,128)120_colors['red'] = awt.Color(255,0,0)121_colors['rosybrown'] = awt.Color(188,143,143)122_colors['royalblue'] = awt.Color(65,105,225)123_colors['saddlebrown'] = awt.Color(139,69,19)124_colors['salmon'] = awt.Color(250,128,114)125_colors['sandybrown'] = awt.Color(244,164,96)126_colors['seagreen'] = awt.Color(46,139,87)127_colors['seashell'] = awt.Color(255,245,238)128_colors['sienna'] = awt.Color(160,82,45)129_colors['silver'] = awt.Color(192,192,192)130_colors['skyblue'] = awt.Color(135,206,235)131_colors['slateblue'] = awt.Color(106,90,205)132_colors['slategray'] = awt.Color(112,128,144)133_colors['snow'] = awt.Color(255,250,250)134_colors['springgreen'] = awt.Color(0,255,127)135_colors['steelblue'] = awt.Color(70,130,180)136_colors['tan'] = awt.Color(210,180,140)137_colors['teal'] = awt.Color(0,128,128)138_colors['thistle'] = awt.Color(216,191,216)139_colors['tomato'] = awt.Color(255,99,71)140_colors['turquoise'] = awt.Color(64,224,208)141_colors['violet'] = awt.Color(238,130,238)142_colors['wheat'] = awt.Color(245,222,179)143_colors['white'] = awt.Color(255,255,255)144_colors['whitesmoke'] = awt.Color(245,245,245)145_colors['yellow'] = awt.Color(255,255,0)146_colors['yellowgreen'] = awt.Color(154,205,50)147class Color(Expression):148 """149 Expression that evaluates to a color object.150 The `val` argument may be specified as an rgba tuple: 151 >>> Color((255, 0, 255))152 (255,0,255)153 Or as a hex color string:154 >>> Color('ff00ff')155 (255,0,255)156 Or as a well known color name:157 >>> Color('magenta')158 (255,0,255)159 160 """161 def __init__(self, val):162 Expression.__init__(self, val)163 def _expr(self, val):164 if isinstance(val, Expression):165 # direct expression specified166 return val.expr167 else:168 # transform val to color169 if isinstance(val, awt.Color):170 # try direct awt color 171 col = val172 elif _colors.has_key(val):173 # try well known174 col = _colors[val]175 elif isinstance(val,(list,tuple)):176 # try as tuple177 col = awt.Color(*val)178 elif isinstance(val, (str,unicode)):179 # look up wellknown180 if hasattr(awt.Color, string.upper(val)):181 col = getattr(awt.Color, string.upper(val))182 else:183 # try as hex string184 val = val[1:] if val[0] == "#" else val185 # convert 3 digit to 6186 if len(val) == 3:187 val = ''.join([val[i]+val[i] for i in range(0,3)])188 # support 8 and 6 digit189 if len(val) == 8:190 # move alpha to end191 val = val[2:] + val[:2]192 col = awt.Color(*[int('0x'+x,0) 193 for x in [val[i:i+2] for i in range(0, len(val), 2)]])194 #for x in val[0:2],val[2:4],val[4:6]])195 else:196 # default197 col = awt.Color(0,0,0)198 return self.factory.filter.literal(col)199 def __repr__(self):200 return "(%d,%d,%d)" % self.rgb201 def _getcolor(self):202 return self.expr.evaluate(awt.Color)203 _color = property(_getcolor)204 def getrgb(self):205 col = self._color206 return (col.red, col.green, col.blue)207 rgb = property(getrgb,None,None,"The RGB value of the color")208 def getrgba(self):209 col = self._color210 return (col.red, col.green, col.blue, col.alpha)211 rgba = property(getrgba,None,None,"The RGBA value of the color")212 213 def getargb(self):214 col = self._color215 return (col.alpha, col.red, col.green, col.blue)216 argb = property(getrgba,None,None,"The ARGB value of the color")217 def gethex(self):218 return self._tohex(self.rgb)219 hex = property(gethex,None,None,"The hex value of the color")220 def getahex(self):221 return self._hex(self.argb)222 ahex = property(gethex,None,None,"The hex value, with alpha, of the color")223 def _tohex(self, vals):224 return ''.join([lang.String.format('%02x', x) for x in vals])225 def gethsl(self): 226 r,g,b = [x/255.0 for x in self.rgb]227 lo, hi = min(r,g,b), max(r,g,b)228 h = s = l = (lo+hi)/2.0229 if lo == hi:230 h = s = 0 # achromatic231 else:232 d = float(hi - lo);233 s = d / (2-hi-lo) if l > 0.5 else d / (hi+lo)234 h = {235 r: lambda x: (g - b) / d + (6 if g < b else 0),236 g: lambda x: (b - r) / d + 2,237 b: lambda x: (r - g) / d + 4238 }[hi](-1)239 h /= 6.0;240 return [x for x in [h, s, l]]; 241 hsl = property(gethsl,None,None,"The HSL/HLS value of the color")242 def opacity(self, o):243 return self.alpha(int(255*o))244 def alpha(self, a):245 return Color(tuple(list(self.rgb) + [a]))246 def interpolate(self, color, n=10, method='linear'):247 """ 248 Interpolates a set of color values beteen this color and the specified249 *color*. 250 The *n* parameter specifies how many values to interpolate, specifically the251 number of classes resulting from the interpolation. The interpolation is 252 inclusive of this and the specified color and returns a list of *n*+1 253 values.254 """ 255 color = Color(color)256 hsl1,hsl2 = self.hsl, color.hsl 257 dhsl = map(lambda x: x[1]-x[0], zip(hsl1,hsl2)) 258 colors = [Color.fromHSL(map(lambda x,y: x + (r/float(n))*y,hsl1,dhsl)) 259 for r in util.interpolate(0, n, n, method)]260 if self._color.alpha != color._color.alpha:261 alphas = util.interpolate(self._color.alpha,color._color.alpha,n,method)262 colors = map(lambda (c,a): c.alpha(int(a)), zip(colors, alphas)) 263 return colors264 @classmethod265 def fromHSL(cls, hsl):266 """267 Creates a color object from the HSL/HLS value.268 """269 h,s,l = hsl270 if s == 0:271 r = g = b = l # achromatic272 else:273 q = l * (1+s) if l < 0.5 else l + s - l * s;274 p = 2 * l - q275 #var q = l < 0.5 ? l * (1 + s) : l + s - l * s;276 #var p = 2 * l - q;277 r = Color._hue2rgb(p, q, h + 1/3.0)278 g = Color._hue2rgb(p, q, h);279 b = Color._hue2rgb(p, q, h - 1/3.0);280 return Color(tuple([int(round(255*x)) for x in [r,g,b]]))281 @classmethod282 def random(cls, n):283 """284 Returns a generator of random colors.285 *n* is the number of colors to generate.286 """287 colors = _colors.values()288 from random import randint289 for i in range(n):290 yield Color(colors[randint(0,len(colors)-1)])291 @classmethod292 def _hue2rgb(cls, p, q, t):293 if t < 0: 294 t += 1;295 if t > 1: 296 t -= 1;297 if t < 1/6.0: 298 return p + (q - p) * 6 * t;299 if t < 1/2.0: 300 return q;301 if t < 2/3.0: 302 return p + (q - p) * (2/3.0 - t) * 6;303 return p;...

Full Screen

Full Screen

theme.py

Source:theme.py Github

copy

Full Screen

1from __future__ import annotations2import os3from typing import Dict4from Fun.utils import colors, pretty5from matplotlib import font_manager as fm6_FONTS = sorted(fm.findSystemFonts(fontpaths=None), key=lambda x: os.path.basename(x))7_FONT_FILE = "Roboto-Bold"8_FONT_SRC = None9for font in _FONTS:10 if _FONT_FILE in font:11 _FONT_SRC = font12 break13assert _FONT_SRC is not None14pretty.color_print(colors.GOOGLE_GREEN_300, f"font source: {_FONT_SRC}")15class Theme:16 def __init__(self) -> None:17 self._colors: Dict[str, str] = {}18 self._alpha: Dict[str, float] = {}19 self.dart_theme()20 def dart_theme(self) -> None:21 self._colors["up"] = colors.PAPER_TEAL_40022 self._colors["down"] = colors.PAPER_RED_40023 self._colors["unchanged"] = colors.PAPER_BLUE_GREY_20024 self._colors["records"] = "#ffffff"25 self._colors["bb0"] = colors.PAPER_PURPLE_40026 self._colors["bb1"] = colors.PAPER_INDIGO_40027 self._colors["bb2"] = colors.PAPER_RED_90028 self._colors["bb3"] = colors.PAPER_BLUE_70029 self._colors["sma0"] = colors.PAPER_YELLOW_30030 self._colors["sma1"] = colors.PAPER_BLUE_GREY_20031 # self._colors["sma2"] = colors.PAPER_LIGHT_GREEN_30032 self._colors["sma2"] = colors.PAPER_INDIGO_40033 self._colors["sma3"] = colors.PAPER_PURPLE_40034 # self._colors["sma4"] = colors.PAPER_ORANGE_40035 self._colors["sma4"] = colors.PAPER_RED_90036 self._colors["sma5"] = colors.PAPER_BLUE_70037 self._colors["sma6"] = colors.PAPER_BROWN_30038 # self._colors["sma6"] = colors.PAPER_LIGHT_GREEN_40039 self._colors["background"] = "#000000"40 self._colors["grid"] = colors.PAPER_GREY_40041 self._colors["ticks"] = "#ffffff"42 self._colors["text"] = "#ffffff"43 self._alpha["sma"] = 1.044 self._alpha["bb"] = 0.645 self._alpha["grid"] = 0.3546 def get_color(self, key: str) -> str:47 return self._colors[key]48 def get_alpha(self, key: str) -> float:49 return self._alpha[key]50 def get_font(self, font_size: float) -> fm.FontProperties:51 return fm.FontProperties(fname=_FONT_SRC, size=font_size)52class InteractiveTheme(Theme):53 def __init__(self):54 super().__init__()55 def dart_theme(self):56 super().dart_theme()57 self._colors["crosshair"] = colors.PAPER_GREY_10058 self._alpha["bb"] = 0.6559 self._alpha["crosshair"] = 0.560class MagicalTheme(Theme):61 def __init__(self):62 super().__init__()63 def dart_theme(self) -> None:64 super().dart_theme()65 self._colors["up"] = colors.PAPER_GREY_30066 self._colors["down"] = colors.PAPER_GREY_90067 self._colors["unchanged"] = colors.PAPER_BLUE_GREY_20068 self._colors["records"] = "#ffffff"69 self._colors["sma3"] = colors.PAPER_PINK_20070 self._colors["sma5"] = colors.PAPER_RED_60071 self._colors["sma7"] = "#000000"72 self._colors["sma10"] = colors.PAPER_YELLOW_50073 self._colors["sma20"] = colors.PAPER_GREEN_50074 self._colors["sma30"] = colors.PAPER_GREY_50075 self._colors["sma60"] = colors.PAPER_BLUE_50076 self._colors["sma100"] = colors.PAPER_PURPLE_40077 self._colors["sma300"] = colors.PAPER_ORANGE_50078 self._colors["background"] = colors.PAPER_GREY_70079 self._colors["grid"] = colors.PAPER_GREY_90080 self._colors["ticks"] = "#ffffff"...

Full Screen

Full Screen

display.py

Source:display.py Github

copy

Full Screen

...14 green = GREEN15 lightgreen = LIGHTGREEN16 white = WHITE17_colors = Colorize()18def get_colors():19 return _colors20def colorize():21 global _colors22 _colors = Colorize()23def no_colors():24 global _colors25 _colors = Colorize()26 _colors.red = ''27 _colors.reset = ''28 _colors.yellow = ''29 _colors.green = ''30 _colors.lightgreen = ''31 _colors.white = ''32def write(msg):33 print_at = cache.print_at34 increment = cache.increment35 counter = cache.log_repeat_log_msg_counter36 if cache.last_log_line != msg:37 sys.stderr.write(msg)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful