mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
ace: minor ace theme tweaks
This commit is contained in:
parent
459a8ed695
commit
b9540e4c49
@ -28,12 +28,12 @@ import coreModule from 'app/core/core_module';
|
||||
import ace from 'ace';
|
||||
|
||||
const ACE_SRC_BASE = "public/vendor/npm/ace-builds/src-noconflict/";
|
||||
const DEFAULT_THEME = "solarized_dark";
|
||||
const DEFAULT_THEME = "grafana-dark";
|
||||
const DEFAULT_MODE = "text";
|
||||
const DEFAULT_MAX_LINES = 10;
|
||||
const DEFAULT_TAB_SIZE = 2;
|
||||
|
||||
const GRAFANA_MODULES = ['mode-prometheus', 'snippets-prometheus'];
|
||||
const GRAFANA_MODULES = ['mode-prometheus', 'snippets-prometheus', 'theme-grafana-dark'];
|
||||
const GRAFANA_MODULE_BASE = "public/app/core/components/code_editor/";
|
||||
|
||||
// Trick for loading additional modules
|
||||
@ -46,9 +46,11 @@ function fixModuleUrl(moduleType, name) {
|
||||
if (_.includes(GRAFANA_MODULES, moduleName)) {
|
||||
baseUrl = GRAFANA_MODULE_BASE;
|
||||
}
|
||||
|
||||
if (moduleType === 'snippets') {
|
||||
componentName = `${moduleType}/${name}.js`;
|
||||
}
|
||||
|
||||
ace.config.setModuleUrl(aceModeName, baseUrl + componentName);
|
||||
}
|
||||
|
||||
@ -83,8 +85,9 @@ function link(scope, elem, attrs) {
|
||||
// disable depreacation warning
|
||||
codeEditor.$blockScrolling = Infinity;
|
||||
// Padding hacks
|
||||
codeEditor.renderer.setScrollMargin(10, 10);
|
||||
codeEditor.renderer.setScrollMargin(15, 15);
|
||||
codeEditor.renderer.setPadding(10);
|
||||
|
||||
setThemeMode(theme);
|
||||
setLangMode(langMode);
|
||||
setEditorContent(scope.content);
|
||||
@ -158,8 +161,7 @@ function link(scope, elem, attrs) {
|
||||
|
||||
function setThemeMode(theme) {
|
||||
fixModuleUrl("theme", theme);
|
||||
let aceThemeName = `ace/theme/${theme}`;
|
||||
codeEditor.setTheme(aceThemeName);
|
||||
codeEditor.setTheme(`ace/theme/${theme}`);
|
||||
}
|
||||
|
||||
function setEditorContent(value) {
|
||||
|
@ -46,7 +46,7 @@ var PrometheusHighlightRules = function() {
|
||||
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : "\\+|\\-|\\*|\\/|%|\\^|=|==|!=|<=|>=|<|>|=~|!~"
|
||||
regex : "\\+|\\-|\\*|\\/|%|\\^|=|==|!=|<=|>=|<|>|=\\~|!\\~"
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : "[\\(]"
|
||||
|
116
public/app/core/components/code_editor/theme-grafana-dark.js
Normal file
116
public/app/core/components/code_editor/theme-grafana-dark.js
Normal file
@ -0,0 +1,116 @@
|
||||
/* jshint ignore:start */
|
||||
|
||||
ace.define("ace/theme/grafana-dark",["require","exports","module","ace/lib/dom"], function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
exports.isDark = true;
|
||||
exports.cssClass = "gf-code-dark";
|
||||
exports.cssText = ".gf-code-dark .ace_gutter {\
|
||||
background: #2f3129;\
|
||||
color: #8f908a\
|
||||
}\
|
||||
.gf-code-dark .ace_print-margin {\
|
||||
width: 1px;\
|
||||
background: #555651\
|
||||
}\
|
||||
.gf-code-dark {\
|
||||
background-color: #111;\
|
||||
color: #e0e0e0\
|
||||
}\
|
||||
.gf-code-dark .ace_cursor {\
|
||||
color: #f8f8f0\
|
||||
}\
|
||||
.gf-code-dark .ace_marker-layer .ace_selection {\
|
||||
background: #49483e\
|
||||
}\
|
||||
.gf-code-dark.ace_multiselect .ace_selection.ace_start {\
|
||||
box-shadow: 0 0 3px 0px #272822;\
|
||||
}\
|
||||
.gf-code-dark .ace_marker-layer .ace_step {\
|
||||
background: rgb(102, 82, 0)\
|
||||
}\
|
||||
.gf-code-dark .ace_marker-layer .ace_bracket {\
|
||||
margin: -1px 0 0 -1px;\
|
||||
border: 1px solid #49483e\
|
||||
}\
|
||||
.gf-code-dark .ace_marker-layer .ace_active-line {\
|
||||
background: #202020\
|
||||
}\
|
||||
.gf-code-dark .ace_gutter-active-line {\
|
||||
background-color: #272727\
|
||||
}\
|
||||
.gf-code-dark .ace_marker-layer .ace_selected-word {\
|
||||
border: 1px solid #49483e\
|
||||
}\
|
||||
.gf-code-dark .ace_invisible {\
|
||||
color: #52524d\
|
||||
}\
|
||||
.gf-code-dark .ace_entity.ace_name.ace_tag,\
|
||||
.gf-code-dark .ace_keyword,\
|
||||
.gf-code-dark .ace_meta.ace_tag,\
|
||||
.gf-code-dark .ace_storage {\
|
||||
color: #fae400\
|
||||
}\
|
||||
.gf-code-dark .ace_punctuation,\
|
||||
.gf-code-dark .ace_punctuation.ace_tag {\
|
||||
color: #fff\
|
||||
}\
|
||||
.gf-code-dark .ace_constant.ace_character,\
|
||||
.gf-code-dark .ace_constant.ace_language,\
|
||||
.gf-code-dark .ace_constant.ace_numeric,\
|
||||
.gf-code-dark .ace_constant.ace_other {\
|
||||
color: #fe85fc\
|
||||
}\
|
||||
.gf-code-dark .ace_invalid {\
|
||||
color: #f8f8f0;\
|
||||
background-color: #f92672\
|
||||
}\
|
||||
.gf-code-dark .ace_invalid.ace_deprecated {\
|
||||
color: #f8f8f0;\
|
||||
background-color: #ae81ff\
|
||||
}\
|
||||
.gf-code-dark .ace_support.ace_constant,\
|
||||
.gf-code-dark .ace_support.ace_function {\
|
||||
color: #66d9ef\
|
||||
}\
|
||||
.gf-code-dark .ace_fold {\
|
||||
background-color: #a6e22e;\
|
||||
border-color: #f8f8f2\
|
||||
}\
|
||||
.gf-code-dark .ace_storage.ace_type,\
|
||||
.gf-code-dark .ace_support.ace_class,\
|
||||
.gf-code-dark .ace_support.ace_type {\
|
||||
font-style: italic;\
|
||||
color: #66d9ef\
|
||||
}\
|
||||
.gf-code-dark .ace_entity.ace_name.ace_function,\
|
||||
.gf-code-dark .ace_entity.ace_other,\
|
||||
.gf-code-dark .ace_entity.ace_other.ace_attribute-name,\
|
||||
.gf-code-dark .ace_variable {\
|
||||
color: #a6e22e\
|
||||
}\
|
||||
.gf-code-dark .ace_variable.ace_parameter {\
|
||||
font-style: italic;\
|
||||
color: #fd971f\
|
||||
}\
|
||||
.gf-code-dark .ace_string {\
|
||||
color: #74e680\
|
||||
}\
|
||||
.gf-code-dark .ace_paren {\
|
||||
color: #f0a842\
|
||||
}\
|
||||
.gf-code-dark .ace_operator {\
|
||||
color: #FFF\
|
||||
}\
|
||||
.gf-code-dark .ace_comment {\
|
||||
color: #75715e\
|
||||
}\
|
||||
.gf-code-dark .ace_indent-guide {\
|
||||
background: url(data:image/png;base64,ivborw0kggoaaaansuheugaaaaeaaaaccayaaaczgbynaaaaekleqvqimwpq0fd0zxbzd/wpaajvaoxesgneaaaaaelftksuqmcc) right repeat-y\
|
||||
}";
|
||||
|
||||
var dom = require("../lib/dom");
|
||||
dom.importCssString(exports.cssText, exports.cssClass);
|
||||
});
|
||||
|
||||
/* jshint ignore:end */
|
@ -3,7 +3,6 @@
|
||||
min-width: 20rem;
|
||||
flex-grow: 1;
|
||||
margin-right: 0.25rem;
|
||||
border: 1px solid #333333;
|
||||
|
||||
&.ace_editor {
|
||||
min-height: 2.60rem;
|
||||
|
@ -21,7 +21,10 @@ module.exports = function(config, grunt) {
|
||||
return;
|
||||
}
|
||||
|
||||
gaze(config.srcDir + '/**/*', function(err, watcher) {
|
||||
gaze([
|
||||
config.srcDir + '/app/**/*',
|
||||
config.srcDir + '/sass/**/*',
|
||||
], function(err, watcher) {
|
||||
|
||||
console.log('Gaze watchers setup');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user