Add all the CodeMirror themes as of 5.14.2
This change makes all the CodeMirror themes as of the 5.14.2 release available in DiffScreen and EditScreen. Updated Documentation/rest-api-accounts.txt to reflect the addition. Change-Id: Ic37e2ac5cfae91ed3cf61d7dc9d3345668715dae
This commit is contained in:
parent
80ebb4529e
commit
efa8e484ce
Documentation
gerrit-extension-api/src/main/java/com/google/gerrit/extensions/client
gerrit-gwtui/src/main/java
com/google/gerrit/client/editor
net/codemirror/theme
lib/codemirror
@ -1695,8 +1695,8 @@ preferences of a user.
|
||||
|`context` ||
|
||||
The number of lines of context when viewing a patch.
|
||||
|`theme` ||
|
||||
The CodeMirror theme. Currently only a subset of light and dark
|
||||
CodeMirror themes are supported.
|
||||
The CodeMirror theme name in upper case, for example `DEFAULT`. All the themes
|
||||
from the CodeMirror release that Gerrit is using are available.
|
||||
|`expand_all_comments` |not set if `false`|
|
||||
Whether all inline comments should be automatically expanded.
|
||||
|`ignore_whitespace` ||
|
||||
@ -1809,9 +1809,8 @@ preferences of a user.
|
||||
|===========================================
|
||||
|Field Name ||Description
|
||||
|`theme` ||
|
||||
The CodeMirror theme. Currently only a subset of light and dark
|
||||
CodeMirror themes are supported. Light themes `DEFAULT`, `ECLIPSE`,
|
||||
`ELEGANT`, `NEAT`. Dark themes `MIDNIGHT`, `NIGHT`, `TWILIGHT`.
|
||||
The CodeMirror theme name in upper case, for example `DEFAULT`. All the themes
|
||||
from the CodeMirror release that Gerrit is using are available.
|
||||
|`key_map_type` ||
|
||||
The CodeMirror key map. Currently only a subset of key maps are
|
||||
supported: `DEFAULT`, `EMACS`, `SUBLIME`, `VIM`.
|
||||
|
@ -17,25 +17,103 @@ package com.google.gerrit.extensions.client;
|
||||
public enum Theme {
|
||||
// Light themes
|
||||
DEFAULT,
|
||||
DAY_3024,
|
||||
BASE16_LIGHT,
|
||||
ECLIPSE,
|
||||
ELEGANT,
|
||||
MDN_LIKE,
|
||||
NEAT,
|
||||
NEO,
|
||||
PARAISO_LIGHT,
|
||||
SOLARIZED_LIGHT,
|
||||
TTCN,
|
||||
XQ_LIGHT,
|
||||
YETI,
|
||||
|
||||
// Dark themes
|
||||
NIGHT_3024,
|
||||
ABCDEF,
|
||||
AMBIANCE,
|
||||
BASE16_DARK,
|
||||
BESPIN,
|
||||
BLACKBOARD,
|
||||
COBALT,
|
||||
COLORFORTH,
|
||||
DRACULA,
|
||||
ERLANG_DARK,
|
||||
HOPSCOTCH,
|
||||
ICECODER,
|
||||
ISOTOPE,
|
||||
LESSER_DARK,
|
||||
LIQUIBYTE,
|
||||
MATERIAL,
|
||||
MBO,
|
||||
MIDNIGHT,
|
||||
MONOKAI,
|
||||
NIGHT,
|
||||
TWILIGHT;
|
||||
PARAISO_DARK,
|
||||
PASTEL_ON_DARK,
|
||||
RAILSCASTS,
|
||||
RUBYBLUE,
|
||||
SETI,
|
||||
SOLARIZED_DARK,
|
||||
THE_MATRIX,
|
||||
TOMORROW_NIGHT_BRIGHT,
|
||||
TOMORROW_NIGHT_EIGHTIES,
|
||||
TWILIGHT,
|
||||
VIBRANT_INK,
|
||||
XQ_DARK,
|
||||
ZENBURN;
|
||||
|
||||
public boolean isDark() {
|
||||
switch (this) {
|
||||
case NIGHT_3024:
|
||||
case ABCDEF:
|
||||
case AMBIANCE:
|
||||
case BASE16_DARK:
|
||||
case BESPIN:
|
||||
case BLACKBOARD:
|
||||
case COBALT:
|
||||
case COLORFORTH:
|
||||
case DRACULA:
|
||||
case ERLANG_DARK:
|
||||
case HOPSCOTCH:
|
||||
case ICECODER:
|
||||
case ISOTOPE:
|
||||
case LESSER_DARK:
|
||||
case LIQUIBYTE:
|
||||
case MATERIAL:
|
||||
case MBO:
|
||||
case MIDNIGHT:
|
||||
case MONOKAI:
|
||||
case NIGHT:
|
||||
case PARAISO_DARK:
|
||||
case PASTEL_ON_DARK:
|
||||
case RAILSCASTS:
|
||||
case RUBYBLUE:
|
||||
case SETI:
|
||||
case SOLARIZED_DARK:
|
||||
case THE_MATRIX:
|
||||
case TOMORROW_NIGHT_BRIGHT:
|
||||
case TOMORROW_NIGHT_EIGHTIES:
|
||||
case TWILIGHT:
|
||||
case VIBRANT_INK:
|
||||
case XQ_DARK:
|
||||
case ZENBURN:
|
||||
return true;
|
||||
case DEFAULT:
|
||||
case DAY_3024:
|
||||
case BASE16_LIGHT:
|
||||
case ECLIPSE:
|
||||
case ELEGANT:
|
||||
case MDN_LIKE:
|
||||
case NEAT:
|
||||
case NEO:
|
||||
case PARAISO_LIGHT:
|
||||
case SOLARIZED_LIGHT:
|
||||
case TTCN:
|
||||
case XQ_LIGHT:
|
||||
case YETI:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -280,27 +280,9 @@ public class EditPreferencesBox extends Composite {
|
||||
}
|
||||
|
||||
private void initTheme() {
|
||||
theme.addItem(
|
||||
Theme.DEFAULT.name().toLowerCase(),
|
||||
Theme.DEFAULT.name());
|
||||
theme.addItem(
|
||||
Theme.ECLIPSE.name().toLowerCase(),
|
||||
Theme.ECLIPSE.name());
|
||||
theme.addItem(
|
||||
Theme.ELEGANT.name().toLowerCase(),
|
||||
Theme.ELEGANT.name());
|
||||
theme.addItem(
|
||||
Theme.NEAT.name().toLowerCase(),
|
||||
Theme.NEAT.name());
|
||||
theme.addItem(
|
||||
Theme.MIDNIGHT.name().toLowerCase(),
|
||||
Theme.MIDNIGHT.name());
|
||||
theme.addItem(
|
||||
Theme.NIGHT.name().toLowerCase(),
|
||||
Theme.NIGHT.name());
|
||||
theme.addItem(
|
||||
Theme.TWILIGHT.name().toLowerCase(),
|
||||
Theme.TWILIGHT.name());
|
||||
for (Theme t : Theme.values()) {
|
||||
theme.addItem(t.name().toLowerCase(), t.name());
|
||||
}
|
||||
}
|
||||
|
||||
private void setKeyMapType(KeyMapType v) {
|
||||
|
@ -27,12 +27,50 @@ import java.util.EnumSet;
|
||||
/** Dynamically loads a known CodeMirror theme's CSS */
|
||||
public class ThemeLoader {
|
||||
private static final ExternalTextResource[] THEMES = {
|
||||
Themes.I.day_3024(),
|
||||
Themes.I.night_3024(),
|
||||
Themes.I.abcdef(),
|
||||
Themes.I.ambiance(),
|
||||
Themes.I.base16_dark(),
|
||||
Themes.I.base16_light(),
|
||||
Themes.I.bespin(),
|
||||
Themes.I.blackboard(),
|
||||
Themes.I.cobalt(),
|
||||
Themes.I.colorforth(),
|
||||
Themes.I.dracula(),
|
||||
Themes.I.eclipse(),
|
||||
Themes.I.elegant(),
|
||||
Themes.I.erlang_dark(),
|
||||
Themes.I.hopscotch(),
|
||||
Themes.I.icecoder(),
|
||||
Themes.I.isotope(),
|
||||
Themes.I.lesser_dark(),
|
||||
Themes.I.liquibyte(),
|
||||
Themes.I.material(),
|
||||
Themes.I.mbo(),
|
||||
Themes.I.mdn_like(),
|
||||
Themes.I.midnight(),
|
||||
Themes.I.monokai(),
|
||||
Themes.I.neat(),
|
||||
Themes.I.neo(),
|
||||
Themes.I.night(),
|
||||
Themes.I.paraiso_dark(),
|
||||
Themes.I.paraiso_light(),
|
||||
Themes.I.pastel_on_dark(),
|
||||
Themes.I.railscasts(),
|
||||
Themes.I.rubyblue(),
|
||||
Themes.I.seti(),
|
||||
Themes.I.solarized(),
|
||||
Themes.I.the_matrix(),
|
||||
Themes.I.tomorrow_night_bright(),
|
||||
Themes.I.tomorrow_night_eighties(),
|
||||
Themes.I.ttcn(),
|
||||
Themes.I.twilight(),
|
||||
Themes.I.vibrant_ink(),
|
||||
Themes.I.xq_dark(),
|
||||
Themes.I.xq_light(),
|
||||
Themes.I.yeti(),
|
||||
Themes.I.zenburn(),
|
||||
};
|
||||
|
||||
private static final EnumSet<Theme> loaded = EnumSet.of(Theme.DEFAULT);
|
||||
|
@ -21,12 +21,50 @@ import com.google.gwt.resources.client.ExternalTextResource;
|
||||
public interface Themes extends ClientBundle {
|
||||
Themes I = GWT.create(Themes.class);
|
||||
|
||||
@Source("3024-day.css") ExternalTextResource day_3024();
|
||||
@Source("3024-night.css") ExternalTextResource night_3024();
|
||||
@Source("abcdef.css") ExternalTextResource abcdef();
|
||||
@Source("ambiance.css") ExternalTextResource ambiance();
|
||||
@Source("base16-dark.css") ExternalTextResource base16_dark();
|
||||
@Source("base16-light.css") ExternalTextResource base16_light();
|
||||
@Source("bespin.css") ExternalTextResource bespin();
|
||||
@Source("blackboard.css") ExternalTextResource blackboard();
|
||||
@Source("cobalt.css") ExternalTextResource cobalt();
|
||||
@Source("colorforth.css") ExternalTextResource colorforth();
|
||||
@Source("dracula.css") ExternalTextResource dracula();
|
||||
@Source("eclipse.css") ExternalTextResource eclipse();
|
||||
@Source("elegant.css") ExternalTextResource elegant();
|
||||
@Source("erlang-dark.css") ExternalTextResource erlang_dark();
|
||||
@Source("hopscotch.css") ExternalTextResource hopscotch();
|
||||
@Source("icecoder.css") ExternalTextResource icecoder();
|
||||
@Source("isotope.css") ExternalTextResource isotope();
|
||||
@Source("lesser-dark.css") ExternalTextResource lesser_dark();
|
||||
@Source("liquibyte.css") ExternalTextResource liquibyte();
|
||||
@Source("material.css") ExternalTextResource material();
|
||||
@Source("mbo.css") ExternalTextResource mbo();
|
||||
@Source("mdn-like.css") ExternalTextResource mdn_like();
|
||||
@Source("midnight.css") ExternalTextResource midnight();
|
||||
@Source("monokai.css") ExternalTextResource monokai();
|
||||
@Source("neat.css") ExternalTextResource neat();
|
||||
@Source("neo.css") ExternalTextResource neo();
|
||||
@Source("night.css") ExternalTextResource night();
|
||||
@Source("paraiso-dark.css") ExternalTextResource paraiso_dark();
|
||||
@Source("paraiso-light.css") ExternalTextResource paraiso_light();
|
||||
@Source("pastel-on-dark.css") ExternalTextResource pastel_on_dark();
|
||||
@Source("railscasts.css") ExternalTextResource railscasts();
|
||||
@Source("rubyblue.css") ExternalTextResource rubyblue();
|
||||
@Source("seti.css") ExternalTextResource seti();
|
||||
@Source("solarized.css") ExternalTextResource solarized();
|
||||
@Source("the-matrix.css") ExternalTextResource the_matrix();
|
||||
@Source("tomorrow-night-bright.css") ExternalTextResource tomorrow_night_bright();
|
||||
@Source("tomorrow-night-eighties.css") ExternalTextResource tomorrow_night_eighties();
|
||||
@Source("ttcn.css") ExternalTextResource ttcn();
|
||||
@Source("twilight.css") ExternalTextResource twilight();
|
||||
@Source("vibrant-ink.css") ExternalTextResource vibrant_ink();
|
||||
@Source("xq-dark.css") ExternalTextResource xq_dark();
|
||||
@Source("xq-light.css") ExternalTextResource xq_light();
|
||||
@Source("yeti.css") ExternalTextResource yeti();
|
||||
@Source("zenburn.css") ExternalTextResource zenburn();
|
||||
|
||||
// When adding a resource, update:
|
||||
// - static initializer in ThemeLoader
|
||||
|
@ -36,12 +36,50 @@ CM_ADDONS = [
|
||||
# in gerrit-extension-api/src/main/java/com/google/gerrit/extensions/common/Theme.java,
|
||||
# in gerrit-gwtui/src/main/java/net/codemirror/theme/Themes.java
|
||||
CM_THEMES = [
|
||||
'3024-day',
|
||||
'3024-night',
|
||||
'abcdef',
|
||||
'ambiance',
|
||||
'base16-dark',
|
||||
'base16-light',
|
||||
'bespin',
|
||||
'blackboard',
|
||||
'cobalt',
|
||||
'colorforth',
|
||||
'dracula',
|
||||
'eclipse',
|
||||
'elegant',
|
||||
'erlang-dark',
|
||||
'hopscotch',
|
||||
'icecoder',
|
||||
'isotope',
|
||||
'lesser-dark',
|
||||
'liquibyte',
|
||||
'material',
|
||||
'mbo',
|
||||
'mdn-like',
|
||||
'midnight',
|
||||
'monokai',
|
||||
'neat',
|
||||
'neo',
|
||||
'night',
|
||||
'paraiso-dark',
|
||||
'paraiso-light',
|
||||
'pastel-on-dark',
|
||||
'railscasts',
|
||||
'rubyblue',
|
||||
'seti',
|
||||
'solarized',
|
||||
'the-matrix',
|
||||
'tomorrow-night-bright',
|
||||
'tomorrow-night-eighties',
|
||||
'ttcn',
|
||||
'twilight',
|
||||
'vibrant-ink',
|
||||
'xq-dark',
|
||||
'xq-light',
|
||||
'yeti',
|
||||
'zenburn',
|
||||
]
|
||||
|
||||
# Available modes must be enumerated here,
|
||||
|
Loading…
x
Reference in New Issue
Block a user