Commit 3aee55352318630d7ed06eb3f70e959409e31e9b
1 parent
139a3322
Exists in
master
and in
4 other branches
colorscheme for code view
Showing
4 changed files
with
80 additions
and
3 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,67 @@ |
| 1 | +.black .highlighttable { | |
| 2 | + background: #111; | |
| 3 | + pre { color: #eee } | |
| 4 | + .highlight { background: #111; border-left:1px solid #555; } | |
| 5 | + | |
| 6 | + .hll { background-color: #ffffff } | |
| 7 | + .c { color: #888888; font-style: italic } /* Comment */ | |
| 8 | + .err { color: #a61717; background-color: #e3d2d2 } /* Error */ | |
| 9 | + .k { color: #CDA869; font-weight: bold } /* Keyword */ | |
| 10 | + .kp { color: #CDA869; font-weight: bold } /* Keyword */ | |
| 11 | + .cm { color: #888888 } /* Comment.Multiline */ | |
| 12 | + .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */ | |
| 13 | + .c1 { color: #888888 } /* Comment.Single */ | |
| 14 | + .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */ | |
| 15 | + .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ | |
| 16 | + .ge { font-style: italic } /* Generic.Emph */ | |
| 17 | + .gr { color: #aa0000 } /* Generic.Error */ | |
| 18 | + .gh { color: #303030 } /* Generic.Heading */ | |
| 19 | + .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ | |
| 20 | + .go { color: #888888 } /* Generic.Output */ | |
| 21 | + .gp { color: #555555 } /* Generic.Prompt */ | |
| 22 | + .gs { font-weight: bold } /* Generic.Strong */ | |
| 23 | + .gu { color: #606060 } /* Generic.Subheading */ | |
| 24 | + .gt { color: #aa0000 } /* Generic.Traceback */ | |
| 25 | + .highlight .kc{font-weight:bold;} /* Keyword.Constant */ | |
| 26 | + .highlight .kd{font-weight:bold;} /* Keyword.Declaration */ | |
| 27 | + .highlight .kn{font-weight:bold;} /* Keyword.Namespace */ | |
| 28 | + .highlight .kp{font-weight:bold;} /* Keyword.Pseudo */ | |
| 29 | + .highlight .kr{font-weight:bold;} /* Keyword.Reserved */ | |
| 30 | + .highlight .kt{color:#458;font-weight:bold;} /* Keyword.Type */ | |
| 31 | + .m { color: #0000DD; font-weight: bold } /* Literal.Number */ | |
| 32 | + .p { color: #eee; } | |
| 33 | + .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ | |
| 34 | + .highlight .na{color:#008080;} /* Name.Attribute */ | |
| 35 | + .highlight .nb{color:#0086B3;} /* Name.Builtin */ | |
| 36 | + .highlight .nc{color:#4d3;font-weight:bold;} /* Name.Class */ | |
| 37 | + .highlight .no{color:turquoise;} /* Name.Constant */ | |
| 38 | + .highlight .ni{color:#800080;} | |
| 39 | + .highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */ | |
| 40 | + .highlight .nf{color:aqua;font-weight:bold;} /* Name.Function */ | |
| 41 | + .highlight .nn{color:#79C3E0;font-weight:bold;} /* Name.Namespace */ | |
| 42 | + .highlight .nt{color:#fc5;} /* Name.Tag */ | |
| 43 | + .highlight .nv{color:#008080;} /* Name.Variable */ | |
| 44 | + .py { color: #336699; font-weight: bold } /* Name.Property */ | |
| 45 | + .ow { color: #008800 } /* Operator.Word */ | |
| 46 | + .w { color: #bbbbbb } /* Text.Whitespace */ | |
| 47 | + .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ | |
| 48 | + .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ | |
| 49 | + .highlight .mi {color:#099;} /* Literal.Number.Integer */ | |
| 50 | + .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ | |
| 51 | + .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ | |
| 52 | + .highlight .sc{color:#d14;} /* Literal.String.Char */ | |
| 53 | + .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ | |
| 54 | + .highlight .s2{color:orange;} /* Literal.String.Double */ | |
| 55 | + .highlight .se{color:orange;} /* Literal.String.Escape */ | |
| 56 | + .highlight .sh{color:orange;} /* Literal.String.Heredoc */ | |
| 57 | + .highlight .si{color:orange;} /* Literal.String.Interpol */ | |
| 58 | + .highlight .sx{color:orange;} /* Literal.String.Other */ | |
| 59 | + .highlight .sr{color:orange;} /* Literal.String.Regex */ | |
| 60 | + .highlight .s1{color:orange;} /* Literal.String.Single */ | |
| 61 | + .highlight .ss{color:orange;} /* Literal.String.Symbol */ | |
| 62 | + .bp { color: #003388 } /* Name.Builtin.Pseudo */ | |
| 63 | + .vc { color: #336699 } /* Name.Variable.Class */ | |
| 64 | + .vg { color: #dd7700 } /* Name.Variable.Global */ | |
| 65 | + .vi { color: cyan } | |
| 66 | +} | |
| 67 | + | ... | ... |
app/helpers/projects_helper.rb
| ... | ... | @@ -15,4 +15,12 @@ module ProjectsHelper |
| 15 | 15 | rescue |
| 16 | 16 | nil |
| 17 | 17 | end |
| 18 | + | |
| 19 | + def switch_colorscheme_link(opts) | |
| 20 | + if cookies[:colorschema].blank? | |
| 21 | + link_to_function "paint it black!", "$.cookie('colorschema','black'); window.location.reload()", opts | |
| 22 | + else | |
| 23 | + link_to_function "paint it white!", "$.cookie('colorschema',''); window.location.reload()", opts | |
| 24 | + end | |
| 25 | + end | |
| 18 | 26 | end | ... | ... |
app/views/refs/_tree.html.haml
app/views/refs/_tree_file.html.haml
| ... | ... | @@ -5,12 +5,14 @@ |
| 5 | 5 | = name |
| 6 | 6 | = link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path] ), :class => "right", :target => "_blank" |
| 7 | 7 | = link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref ), :class => "right", :style => "margin-right:10px;" |
| 8 | + = switch_colorscheme_link(:class => "right", :style => "margin-right:10px;color:orange") | |
| 8 | 9 | %br/ |
| 9 | 10 | - if file.text? |
| 10 | 11 | .view_file_content |
| 11 | 12 | - unless file.empty? |
| 12 | - :erb | |
| 13 | - <%= raw file.colorize %> | |
| 13 | + %div{:class => cookies[:colorschema]} | |
| 14 | + :erb | |
| 15 | + <%= raw file.colorize %> | |
| 14 | 16 | - else |
| 15 | 17 | %h3 |
| 16 | 18 | %center Empty file | ... | ... |