Skip to content

Commit

Permalink
Vivid theme (#92)
Browse files Browse the repository at this point in the history
* Start adding vivid

* Remove category from plugin.xml

* Update build script

* Update file colors

* Update changelog

* Update tests

* Don't indent JSON
  • Loading branch information
mskelton authored Sep 18, 2019
1 parent 31ed8d4 commit 328c9bd
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 69 deletions.
104 changes: 55 additions & 49 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

#### 3.0.0

- Adds vivid and vivid italic themes!
- This change may require you to reselect the color theme in the `Editor` -> `Color Scheme` preferences.
- Update file colors to improve contrast

#### 2.12.1

- Fix JavaScript and TypeScript colors after the 2019.2 release
Expand Down Expand Up @@ -37,51 +43,51 @@
#### 2.9.0

- Improves syntax highlighting for the following languages:
- Ruby
- ERB
- RDoc
- Slim
- Objective-C
- Swift
- Ruby
- ERB
- RDoc
- Slim
- Objective-C
- Swift

#### 2.8.0

- Improves syntax highlighting for the following languages:
- C
- C++
- Rust
- C
- C++
- Rust
- Improves syntax highlighting for Rider

#### 2.7.0

- Update class reference to chalky
- Improves syntax highlighting for the following languages:
- Go
- x86 assembly
- Python
- Django/Jinja2 Template
- Mako Template
- Jupyter
- Puppet
- GQL
- Go
- x86 assembly
- Python
- Django/Jinja2 Template
- Mako Template
- Jupyter
- Puppet
- GQL

#### 2.6.0

- Update Java static final field color to whiskey
- Update less and stylus variables to white
- Improves syntax highlighting for the following languages:
- Dart
- Pug
- Dart
- Pug

#### 2.5.0

- Update global constant color to whiskey
- Improves syntax highlighting for the following languages:
- CoffeeScript
- Haml
- PHP
- Sass
- XPath
- CoffeeScript
- Haml
- PHP
- Sass
- XPath

#### 2.4.1

Expand All @@ -96,10 +102,10 @@

- Update groovy unresolved reference color
- Improves syntax highlighting for the following languages:
- Python
- Bash
- reStructuredText
- Buildout config
- Python
- Bash
- reStructuredText
- Buildout config

#### 2.2.1

Expand Down Expand Up @@ -136,39 +142,39 @@
#### 1.7.1

- Improves syntax highlighting for the following languages:
- JSP
- Sass
- OSGi Manifest
- XPath
- Less
- JSP
- Sass
- OSGi Manifest
- XPath
- Less

#### 1.6.0

- Improves syntax highlighting for the following languages:
- Markdown
- Properties
- Angular
- XML
- Database
- Regex
- Markdown
- Properties
- Angular
- XML
- Database
- Regex

#### 1.5.0

- Improves syntax highlighting for the following languages:
- JavaScript
- TypeScript
- Kotlin
- CSS
- JavaScript
- TypeScript
- Kotlin
- CSS

#### 1.4.1

- Improves syntax highlighting for the following languages:
- Groovy
- YAML
- EditorConfig
- Gerkin
- JSON
- HTML
- Groovy
- YAML
- EditorConfig
- Gerkin
- JSON
- HTML

#### 1.3.6

Expand Down
46 changes: 34 additions & 12 deletions scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@
FILE_NAME = 'one_dark'


def build_theme_name(color: str, italic: bool):
name = 'One Dark'

if color != 'normal':
name += ' ' + color

if italic:
name += ' italic'

return name


class Builder:
def __init__(self, italic: bool, filename: str):
def __init__(self, color: str, italic: bool, filename: str):
self.color = color
self.italic = italic
self.filename = filename

Expand Down Expand Up @@ -50,7 +63,7 @@ def get_color(self, color: str) -> str:
return color

def build_yaml(self) -> dict:
self.colors = self.read_yaml('colors')
self.colors = self.read_yaml(os.path.join('colors', self.color))
ide = self.read_yaml('ide')
theme = self.read_yaml('theme')

Expand Down Expand Up @@ -101,10 +114,7 @@ def transform(self, text: str) -> str:
def build_xml(self) -> ElementTree:
scheme = ET.Element('scheme')

scheme.attrib['name'] = '%s italic' % self.yaml['name'] \
if self.italic \
else self.yaml['name']

scheme.attrib['name'] = build_theme_name(self.color, self.italic)
scheme.attrib['parent_scheme'] = self.yaml['parent-scheme']
scheme.attrib['version'] = '142'

Expand Down Expand Up @@ -142,26 +152,38 @@ def write_file(self) -> None:
self.xml.write(os.path.join(DEST_DIR, self.filename))


def write_json(data: dict, output_path: str):
with open(os.path.join(DEST_DIR, output_path + '.theme.json'), 'w') as output_file:
json.dump(data, output_file)


def build_json():
input_path = os.path.join(DEST_DIR, 'one_dark.theme.json')
output_path = os.path.join(DEST_DIR, 'one_dark_italic.theme.json')

with open(input_path, 'r') as input_file:
data = json.load(input_file, object_pairs_hook=OrderedDict)

data['name'] = 'One Dark italic'
data['name'] = build_theme_name('normal', True)
data['editorScheme'] = '/themes/one_dark_italic.xml'
write_json(data, 'one_dark_italic')

data['name'] = build_theme_name('vivid', False)
data['editorScheme'] = '/themes/one_dark_vivid.xml'
write_json(data, 'one_dark_vivid')

with open(output_path, 'w') as output_file:
json.dump(data, output_file, indent=2)
data['name'] = build_theme_name('vivid', True)
data['editorScheme'] = '/themes/one_dark_vivid_italic.xml'
write_json(data, 'one_dark_vivid_italic')


def main():
if not os.path.exists(DEST_DIR):
os.makedirs(DEST_DIR)

Builder(False, '%s.xml' % FILE_NAME).run()
Builder(True, '%s_italic.xml' % FILE_NAME).run()
Builder('normal', False, '%s.xml' % FILE_NAME).run()
Builder('normal', True, '%s_italic.xml' % FILE_NAME).run()
Builder('vivid', False, '%s_vivid.xml' % FILE_NAME).run()
Builder('vivid', True, '%s_vivid_italic.xml' % FILE_NAME).run()

build_json()

Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions scripts/config/colors/vivid.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
%YAML 1.2
---
chalky: e5c07b
coral: ef596f
dark: 5c6370
error: f44747
fountainBlue: 2bbac5
green: 89ca78
lightWhite: bbbbbb
malibu: 61afef
purple: d55fde
whiskey: d19a66
1 change: 0 additions & 1 deletion scripts/config/theme.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
%YAML 1.2
---
name: One dark
parent-scheme: Darcula
colors:
ADDED_LINES_COLOR: green
Expand Down
7 changes: 7 additions & 0 deletions scripts/test/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ def file_exists(file_path):
return os.path.exists(full_path) and os.path.isfile(full_path)

def test_theme_files(self):
# Normal
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark.theme.json'))
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark.xml'))
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark_italic.theme.json'))
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark_italic.xml'))

# Vivid
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark_vivid.theme.json'))
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark_vivid.xml'))
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark_vivid_italic.theme.json'))
self.assertTrue(self.file_exists(THEME_DIR + '/one_dark_vivid_italic.xml'))

def test_meta_files(self):
self.assertTrue(self.file_exists(META_DIR + '/plugin.xml'))
self.assertTrue(self.file_exists(META_DIR + '/pluginIcon.svg'))
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<idea-plugin>
<id>com.markskelton.one-dark-theme</id>
<name>One Dark theme</name>
<category>UI</category>
<vendor email="[email protected]"
url="https://github.com/one-dark/jetbrains-one-dark-theme">Mark Skelton</vendor>

Expand All @@ -10,5 +9,7 @@
<extensions defaultExtensionNs="com.intellij">
<themeProvider id="f92a0fa7-1a98-47cd-b5cb-78ff67e6f4f3" path="/themes/one_dark.theme.json"/>
<themeProvider id="1a92aa6f-c2f1-4994-ae01-6a78e43eeb24" path="/themes/one_dark_italic.theme.json"/>
<themeProvider id="4b6007f7-b596-4ee2-96f9-968d3d3eb392" path="/themes/one_dark_vivid.theme.json"/>
<themeProvider id="4f556d32-83cb-4b8b-9932-c4eccc4ce3af" path="/themes/one_dark_vivid_italic.theme.json"/>
</extensions>
</idea-plugin>
12 changes: 6 additions & 6 deletions src/main/resources/themes/one_dark.theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@
},

"FileColor": {
"Yellow": "#563b22cc",
"Green": "#334e1fcc",
"Blue": "#1e264bcc",
"Violet": "#4b1e4bcc",
"Orange": "#562b22cc",
"Rose": "#50202bcc"
"Yellow": "#563b2255",
"Green": "#334e1f55",
"Blue": "#28436d55",
"Violet": "#37115655",
"Orange": "#562b2255",
"Rose": "#561a2b55"
},

"Link": {
Expand Down

0 comments on commit 328c9bd

Please sign in to comment.