colorscheme for code view

This commit is contained in:
Dmitriy Zaporozhets 2011-11-26 01:42:42 +02:00
parent 139a332293
commit 3aee553523
4 changed files with 80 additions and 3 deletions

View file

@ -0,0 +1,67 @@
.black .highlighttable {
background: #111;
pre { color: #eee }
.highlight { background: #111; border-left:1px solid #555; }
.hll { background-color: #ffffff }
.c { color: #888888; font-style: italic } /* Comment */
.err { color: #a61717; background-color: #e3d2d2 } /* Error */
.k { color: #CDA869; font-weight: bold } /* Keyword */
.kp { color: #CDA869; font-weight: bold } /* Keyword */
.cm { color: #888888 } /* Comment.Multiline */
.cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.c1 { color: #888888 } /* Comment.Single */
.cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.ge { font-style: italic } /* Generic.Emph */
.gr { color: #aa0000 } /* Generic.Error */
.gh { color: #303030 } /* Generic.Heading */
.gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.go { color: #888888 } /* Generic.Output */
.gp { color: #555555 } /* Generic.Prompt */
.gs { font-weight: bold } /* Generic.Strong */
.gu { color: #606060 } /* Generic.Subheading */
.gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc{font-weight:bold;} /* Keyword.Constant */
.highlight .kd{font-weight:bold;} /* Keyword.Declaration */
.highlight .kn{font-weight:bold;} /* Keyword.Namespace */
.highlight .kp{font-weight:bold;} /* Keyword.Pseudo */
.highlight .kr{font-weight:bold;} /* Keyword.Reserved */
.highlight .kt{color:#458;font-weight:bold;} /* Keyword.Type */
.m { color: #0000DD; font-weight: bold } /* Literal.Number */
.p { color: #eee; }
.s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na{color:#008080;} /* Name.Attribute */
.highlight .nb{color:#0086B3;} /* Name.Builtin */
.highlight .nc{color:#4d3;font-weight:bold;} /* Name.Class */
.highlight .no{color:turquoise;} /* Name.Constant */
.highlight .ni{color:#800080;}
.highlight .ne{color:#900;font-weight:bold;} /* Name.Exception */
.highlight .nf{color:aqua;font-weight:bold;} /* Name.Function */
.highlight .nn{color:#79C3E0;font-weight:bold;} /* Name.Namespace */
.highlight .nt{color:#fc5;} /* Name.Tag */
.highlight .nv{color:#008080;} /* Name.Variable */
.py { color: #336699; font-weight: bold } /* Name.Property */
.ow { color: #008800 } /* Operator.Word */
.w { color: #bbbbbb } /* Text.Whitespace */
.mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi {color:#099;} /* Literal.Number.Integer */
.mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc{color:#d14;} /* Literal.String.Char */
.sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2{color:orange;} /* Literal.String.Double */
.highlight .se{color:orange;} /* Literal.String.Escape */
.highlight .sh{color:orange;} /* Literal.String.Heredoc */
.highlight .si{color:orange;} /* Literal.String.Interpol */
.highlight .sx{color:orange;} /* Literal.String.Other */
.highlight .sr{color:orange;} /* Literal.String.Regex */
.highlight .s1{color:orange;} /* Literal.String.Single */
.highlight .ss{color:orange;} /* Literal.String.Symbol */
.bp { color: #003388 } /* Name.Builtin.Pseudo */
.vc { color: #336699 } /* Name.Variable.Class */
.vg { color: #dd7700 } /* Name.Variable.Global */
.vi { color: cyan }
}

View file

@ -15,4 +15,12 @@ module ProjectsHelper
rescue
nil
end
def switch_colorscheme_link(opts)
if cookies[:colorschema].blank?
link_to_function "paint it black!", "$.cookie('colorschema','black'); window.location.reload()", opts
else
link_to_function "paint it white!", "$.cookie('colorschema',''); window.location.reload()", opts
end
end
end

View file

@ -3,7 +3,7 @@
%span
%d
= link_to tree_project_ref_path(@project, @ref, :path => nil), :remote => true do
= @project.name
= @project.code
- tree.breadcrumbs(2) do |link|
\/
= link

View file

@ -5,12 +5,14 @@
= name
= link_to "raw", blob_project_ref_path(@project, @ref, :path => params[:path] ), :class => "right", :target => "_blank"
= link_to "history", project_commits_path(@project, :path => params[:path], :ref => @ref ), :class => "right", :style => "margin-right:10px;"
= switch_colorscheme_link(:class => "right", :style => "margin-right:10px;color:orange")
%br/
- if file.text?
.view_file_content
- unless file.empty?
:erb
<%= raw file.colorize %>
%div{:class => cookies[:colorschema]}
:erb
<%= raw file.colorize %>
- else
%h3
%center Empty file