Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# encoding: utf-8 

2from . import * 

3 

4def coloredText( 

5 text="", 

6 color="red", 

7 htmlClass="", 

8 pull=False, 

9 size=False, 

10 addBackgroundColor=False): 

11 """ 

12 *Colour text a given colour* 

13 

14 **Key Arguments** 

15 

16 - ``text`` -- the text to color 

17 - ``color`` -- the color 

18 - ``htmlClass`` -- the class for the text 

19 - ``size`` -- the relative size of the text 

20 - ``addBackgroundColor`` -- add a complimentary background color to the text 

21  

22 

23 **Return** 

24 

25 - ``text`` -- the coloured text span 

26  

27 """ 

28 if pull is not False: 

29 pull = """pull-%(pull)s""" % locals() 

30 else: 

31 pull = "" 

32 

33 if size is not False: 

34 size = """size-%(size)s""" % locals() 

35 else: 

36 size = "" 

37 

38 if addBackgroundColor is not False: 

39 addBackgroundColor = "addBackground" 

40 else: 

41 addBackgroundColor = "" 

42 

43 text = """<span class="colortext %(color)s %(addBackgroundColor)s %(htmlClass)s %(pull)s %(size)s">%(text)s</span>""" % locals( 

44 ) 

45 

46 return text