MCPcopy Create free account
hub / github.com/ActiveState/code / Theme

Class Theme

recipes/Python/578138_gprof2dotpy/recipe-578138.py:2418–2534  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2416
2417
2418class Theme:
2419
2420 def __init__(self,
2421 bgcolor = (0.0, 0.0, 1.0),
2422 mincolor = (0.0, 0.0, 0.0),
2423 maxcolor = (0.0, 0.0, 1.0),
2424 fontname = "Arial",
2425 minfontsize = 10.0,
2426 maxfontsize = 10.0,
2427 minpenwidth = 0.5,
2428 maxpenwidth = 4.0,
2429 gamma = 2.2,
2430 skew = 1.0):
2431 self.bgcolor = bgcolor
2432 self.mincolor = mincolor
2433 self.maxcolor = maxcolor
2434 self.fontname = fontname
2435 self.minfontsize = minfontsize
2436 self.maxfontsize = maxfontsize
2437 self.minpenwidth = minpenwidth
2438 self.maxpenwidth = maxpenwidth
2439 self.gamma = gamma
2440 self.skew = skew
2441
2442 def graph_bgcolor(self):
2443 return self.hsl_to_rgb(*self.bgcolor)
2444
2445 def graph_fontname(self):
2446 return self.fontname
2447
2448 def graph_fontsize(self):
2449 return self.minfontsize
2450
2451 def node_bgcolor(self, weight):
2452 return self.color(weight)
2453
2454 def node_fgcolor(self, weight):
2455 return self.graph_bgcolor()
2456
2457 def node_fontsize(self, weight):
2458 return self.fontsize(weight)
2459
2460 def edge_color(self, weight):
2461 return self.color(weight)
2462
2463 def edge_fontsize(self, weight):
2464 return self.fontsize(weight)
2465
2466 def edge_penwidth(self, weight):
2467 return max(weight*self.maxpenwidth, self.minpenwidth)
2468
2469 def edge_arrowsize(self, weight):
2470 return 0.5 * math.sqrt(self.edge_penwidth(weight))
2471
2472 def fontsize(self, weight):
2473 return max(weight**2 * self.maxfontsize, self.minfontsize)
2474
2475 def color(self, weight):

Callers 1

recipe-578138.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected