Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import: port bw style from Pygments to Rouge #64

Merged
merged 1 commit into from
May 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rouge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,4 @@ def highlight(text, lexer, formatter, &b)
load load_dir.join('rouge/themes/gruvbox.rb')
load load_dir.join('rouge/themes/tulip.rb')
load load_dir.join('rouge/themes/pastie.rb')
load load_dir.join('rouge/themes/bw.rb')
41 changes: 41 additions & 0 deletions lib/rouge/themes/bw.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*- #
# frozen_string_literal: true

module Rouge
module Themes
# A port of the bw style from Pygments.
# See https://bitbucket.org/birkenfeld/pygments-main/src/default/pygments/styles/bw.py
class BlackWhiteTheme < CSSTheme
name 'bw'

style Text, :fg => '#000000', :bg => '#ffffff'

style Comment, :italic => true
style Comment::Preproc, :italic => false

style Keyword, :bold => true
style Keyword::Pseudo, :bold => false
style Keyword::Type, :bold => false

style Operator, :bold => true

style Name::Class, :bold => true
style Name::Namespace, :bold => true
style Name::Exception, :bold => true
style Name::Entity, :bold => true
style Name::Tag, :bold => true

style Literal::String, :italic => true
style Literal::String::Interpol, :bold => true
style Literal::String::Escape, :bold => true

style Generic::Heading, :bold => true
style Generic::Subheading, :bold => true
style Generic::Emph, :italic => true
style Generic::Strong, :bold => true
style Generic::Prompt, :bold => true

style Error, :fg => '#FF0000'
end
end
end