Skip to content

Commit

Permalink
make subpixel base style and Pygments style generator
Browse files Browse the repository at this point in the history
make new trueskill style that inherits subpixel
  • Loading branch information
Heungsub Lee committed Oct 19, 2012
1 parent 8a16ac3 commit 7313b6c
Show file tree
Hide file tree
Showing 23 changed files with 275 additions and 4 deletions.
Binary file added old_trueskill/static/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added old_trueskill/static/favicon.ico
Binary file not shown.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
7 changes: 7 additions & 0 deletions old_trueskill/theme.conf
@@ -0,0 +1,7 @@
[theme]
inherit = subleebase
pygments_style = subleestyles.TrueSkillStyle

[options]
hide_toc = true
github_ribbon = http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png
Binary file added subpixel/static/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added subpixel/static/logo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
185 changes: 185 additions & 0 deletions subpixel/static/style.css_t
@@ -0,0 +1,185 @@
@import url(basic.css);
@import url(http://fonts.googleapis.com/css?family=Galindo);
@import url(http://fonts.googleapis.com/css?family=McLaren);
@import url(http://fonts.googleapis.com/css?family=Ubuntu+Mono:400,700);

body {
margin: 0;
padding: 0;
min-width: 750px;
font-family: McLaren, sans-serif;
font-size: 20px;
line-height: 1.5;
color: {{ theme_text_color }};
background: {{ theme_bg_color }} url(bg.gif) repeat-x left top;
}

.wrap {
margin: 0 auto;
padding: 50px;
width: 650px;
}

h1 {
margin-bottom: 0;
padding-top: {{ theme_logo_height }};
text-align: center;
font-family: Galindo, sans-serif;
font-size: 30px;
background: url(logo.gif) no-repeat center top;
}

h1 a {
display: none;
}

.section p {
margin-top: -8px;
text-align: center;
font-size: 11px;
font-weight: bold;
color: {{ theme_title_color }};
}
.section .section p {
margin-top: 20px;
text-align: left;
font-size: 20px;
font-weight: normal;
color: {{ theme_text_color }};
}

h2 {
float: left;
margin: 20px -30px;
padding-left: 30px;
padding-bottom: 5px;
font-size: 20px;
line-height: 45px;
color: {{ theme_title_color }};
background: url(title.gif) no-repeat left;
}

h2 a {
display: block;
position: relative;
float: right;
margin-right: -10px;
margin-bottom: -5px;
width: 20px;
height: 50px;
visibility: visible !important;
text-indent: -9999px;
background: url(title.gif) no-repeat right;
}

h2:hover a {
padding: 0 10px;
text-indent: 0;
}

h2 a:link, h2 a:visited {
text-decoration: none;
color: {{ theme_text_color }};
}

p, dl, .section {
clear: left;
}

em {
font-family: 'Times New Roman', Times, serif;
}

a:link, a:visited {
text-decoration: none;
}
a:link {
color: {{ theme_link_color }};
}
a:visited {
color: {{ theme_vlink_color }};
}
a:hover {
text-decoration: underline;
}

tt, .highlight pre, .pre {
font-family: 'Ubuntu Mono', monospace;
}

tt {
color: {{ theme_code_color }};
}

.highlight pre {
padding-left: 30px;
font-size: 15px;
line-height: 1.4;
}

.figure {
text-align: center;
}

.headerlink {
padding-left: 0.5em;
}

.footer {
margin-top: 50px;
text-align: center;
font-size: 11px;
color: {{ theme_title_color }};
}

.footer a:link, .footer a:visited {
text-decoration: none;
color: {{ theme_text_color }};
}

.field-list ul {
padding-left: 10px;
list-style: square;
}

.field-list .field-name {
font-weight: normal;
}

dl {
font-size: 15px;
}

dt:target, .highlighted {
background: {{ theme_target_color }};
}

.descclassname {
color: {{ theme_title_color }};
}

.descname {
color: {{ theme_text_color }};
}

table.field-list {
margin-bottom: 10px;
}
table.field-list td, table.field-list th {
padding: 0;
padding-right: 20px;
}
table.field-list th {
color: {{ theme_title_color }};
}
table.field-list strong {
font-family: 'Times New Roman', Times, serif;
font-style: italic;
font-weight: normal;
}
table.field-list .field-body {
padding-bottom: 10px;
}
table.field-list .field-body p {
font-size: 15px;
}
Binary file added subpixel/static/title.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions subpixel/theme.conf
@@ -0,0 +1,14 @@
[theme]
inherit = subleebase
pygments_style = subpixelstyle.generate(subpixel)

[options]
hide_toc = true
logo_height = 90px
bg_color = #eee
text_color = #000
title_color = #000
code_color = #000
link_color = #00f
vlink_color = #60c
target_color = #fff
56 changes: 56 additions & 0 deletions subpixelstyle.py
@@ -0,0 +1,56 @@
import ConfigParser
import os
import re
import sys

from pygments.style import Style
from pygments.token import *


class ModuleHook(object):

def __init__(self, module):
self.module = module

def __getattr__(self, attr):
if attr.startswith('generate('):
return self.generate(re.search(r'\((.+)\)$', attr).group(1))
else:
return getattr(self.module, attr)

def generate(self, theme):
config = ConfigParser.ConfigParser()
path = os.path.join(os.path.dirname(__file__), theme, 'theme.conf')
with open(path) as f:
config.readfp(f)
theme_options = dict(config.items('options'))
def replace(match):
color = theme_options.get(match.group(1), '#000000')
color = re.sub('#(.)(.)(.)$', '#\1\1\2\2\3\3', color)
return color
for token, opt in SubpixelStyle.meta_styles.iteritems():
color = theme_options.get(opt, '#000000')
color = re.sub('#(.)(.)(.)$', '#\1\1\2\2\3\3', color)
SubpixelStyle.styles[token] = color
SubpixelStyle.__name__ = '%sStyle' % theme.title()
return SubpixelStyle


class SubpixelStyle(Style):

background_color = 'transparent'
meta_styles = {
Keyword: 'title_color', # class: 'k'
Operator: 'text_color', # class: 'o'
Punctuation: 'text_color', # class: 'p'
Name: 'text_color', # class: 'n'
Name.Variable: 'title_color', # class: 'nv'
Number: 'title_color', # class: 'm'
String: 'title_color', # class: 's'
Generic.Output: 'text_color', # class: 'go'
Generic.Prompt: 'title_color', # class: 'gp'
Generic.Error: 'vlink_color', # class: 'gr'
}


sys.modules[__name__] = ModuleHook(sys.modules[__name__])
Binary file modified trueskill/static/bg.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified trueskill/static/favicon.ico
Binary file not shown.
Binary file added trueskill/static/github.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trueskill/static/image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trueskill/static/logo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added trueskill/static/title.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions trueskill/theme.conf
@@ -1,7 +1,16 @@
[theme]
inherit = subleebase
pygments_style = subleestyles.TrueSkillStyle
inherit = subpixel
pygments_style = subpixelstyle.generate(trueskill)

[options]
hide_toc = true
github_ribbon = http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png
opengraph_image = _static/image.png
github_ribbon = _static/github.png

logo_height = 95px
bg_color = #f7eacf
text_color = #634
title_color = #a42
code_color = #a42
link_color = #47a
vlink_color = #969
target_color = #fef5d1

0 comments on commit 7313b6c

Please sign in to comment.