import pyssed background = pyssed.style('background: #123456') italic = pyssed.style('font-style: italic') bold = pyssed.style('font-weight: bold') blue = pyssed.style('color: blue') blue_ul = pyssed.style({'ul': {'background': 'blue'}}) css = { 'a:hover': background + italic, 'a:visited': background + bold + blue, '.someclass': blue_ul + { 'a:visited': italic, }, '.anotherclass': blue_ul + { 'a:visited': bold, }, } print "\n".join(pyssed.generate(css))
def rounded(radius): return pyssed.style({ 'border-radius': radius, '-moz-border-radius': int(round(radius * 1.5)), '-webkit-border-radius': int(round(radius * 2.0)), })
import pyssed # You can use a variety of syntaxes to specify your styles. The middle dict # form is preferred, because CSS uses dash-separated names for things like # font-weight, which can only be expressed via the dict form. red = pyssed.style('color: red;') green = pyssed.style({'color': 'green'}) blue = pyssed.style(color='blue') # You can even mix & match them, but this isn't really recommended. aqua_bold = pyssed.style('color: aqua;', { 'font-weight': 'bold'}, background='blue') css = { '.red': red, '.green': green, '.blue': blue, '.aquabold': aqua_bold, '.bluebold': blue + { 'font-weight': 'bold', } } print "\n".join(pyssed.generate(css))
import pyssed site_background = "#123450" red = pyssed.style('color: red;') blue = pyssed.style(color='blue') green = {'color': 'green'} bold = pyssed.style('font-weight: bold;') red_bold = red + bold def rounded(radius): return pyssed.style({ 'border-radius': radius, '-moz-border-radius': int(round(radius * 1.5)), '-webkit-border-radius': int(round(radius * 2.0)), }) css = { '.blue': blue, '.green': green, 'ul li': rounded(3) + blue + { 'font-style': 'italic', 'background': site_background, }, 'div.ground': rounded(7) + red_bold + { 'p': { 'text-align': 'left', 'em': { 'font-size': '14pt', 'background': site_background, }
import pyssed site_background = "#123450" red = pyssed.style('color: red;') blue = pyssed.style(color='blue') green = {'color': 'green'} bold = pyssed.style('font-weight: bold;') red_bold = red + bold def rounded(radius): return pyssed.style({ 'border-radius': radius, '-moz-border-radius': int(round(radius * 1.5)), '-webkit-border-radius': int(round(radius * 2.0)), }) css = { '.blue': blue, '.green': green, 'ul li': rounded(3) + blue + { 'font-style': 'italic', 'background': site_background, }, 'div.ground': rounded(7) + red_bold + { 'p': { 'text-align': 'left', 'em': { 'font-size': '14pt', 'background': site_background,
import pyssed red = pyssed.style('color: red') green = pyssed.style('color: green') bold = pyssed.style('font-weight: bold') css = { 'a:hover': red + bold, 'a:visited': green + bold, 'a:link': bold + { 'color': 'purple', }, } print '\n'.join(pyssed.generate(css))
import pyssed # You can use a variety of syntaxes to specify your styles. The middle dict # form is preferred, because CSS uses dash-separated names for things like # font-weight, which can only be expressed via the dict form. red = pyssed.style('color: red;') green = pyssed.style({'color': 'green'}) blue = pyssed.style(color='blue') # You can even mix & match them, but this isn't really recommended. aqua_bold = pyssed.style('color: aqua;', {'font-weight': 'bold'}, background='blue') css = { '.red': red, '.green': green, '.blue': blue, '.aquabold': aqua_bold, '.bluebold': blue + { 'font-weight': 'bold', } } print "\n".join(pyssed.generate(css))