Browse Source

Added OneDark theme.

pull/130/head
weisj 5 years ago
parent
commit
c0dcac6765
  1. 1
      core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java
  2. 1
      core/src/test/java/ui/ComponentDemo.java
  3. 9
      core/src/test/java/ui/comboBox/ComboBoxDemo.java
  4. 74
      theme/src/main/java/com/github/weisj/darklaf/theme/OneDarkTheme.java
  5. 157
      theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_defaults.properties
  6. 49
      theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_icons.properties
  7. 27
      theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_icons_adjustments.properties
  8. 337
      theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_styleSheet.css
  9. 37
      theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_ui.properties

1
core/src/main/java/com/github/weisj/darklaf/ui/DarkPopupFactory.java

@ -64,6 +64,7 @@ public class DarkPopupFactory extends PopupFactory {
// That is why we set window background explicitly. // That is why we set window background explicitly.
Window window = SwingUtilities.getWindowAncestor(contents); Window window = SwingUtilities.getWindowAncestor(contents);
if (window != null) { if (window != null) {
window.setBackground(UIManager.getColor("PopupMenu.translucentBackground"));
boolean install = true; boolean install = true;
if (window instanceof RootPaneContainer) { if (window instanceof RootPaneContainer) {
JRootPane rootPane = ((RootPaneContainer) window).getRootPane(); JRootPane rootPane = ((RootPaneContainer) window).getRootPane();

1
core/src/test/java/ui/ComponentDemo.java

@ -69,6 +69,7 @@ public interface ComponentDemo {
new IntelliJTheme(), new IntelliJTheme(),
new SolarizedLightTheme(), new SolarizedLightTheme(),
new SolarizedDarkTheme(), new SolarizedDarkTheme(),
new OneDarkTheme(),
new HighContrastLightTheme(), new HighContrastLightTheme(),
new HighContrastDarkTheme()}) { new HighContrastDarkTheme()}) {
createThemeItem(currentThemeName, menu, bg, theme); createThemeItem(currentThemeName, menu, bg, theme);

9
core/src/test/java/ui/comboBox/ComboBoxDemo.java

@ -23,6 +23,7 @@
*/ */
package ui.comboBox; package ui.comboBox;
import com.github.weisj.darklaf.ui.combobox.ComboBoxConstants;
import com.github.weisj.darklaf.util.PropertyKey; import com.github.weisj.darklaf.util.PropertyKey;
import ui.ComponentDemo; import ui.ComponentDemo;
import ui.DemoPanel; import ui.DemoPanel;
@ -58,13 +59,13 @@ public class ComboBoxDemo implements ComponentDemo {
addActionListener(e -> comboBox.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT addActionListener(e -> comboBox.setComponentOrientation(isSelected() ? ComponentOrientation.LEFT_TO_RIGHT
: ComponentOrientation.RIGHT_TO_LEFT)); : ComponentOrientation.RIGHT_TO_LEFT));
}}); }});
controlPanel.add(new JCheckBox("JComboBox.isTreeCellEditor") {{ controlPanel.add(new JCheckBox(ComboBoxConstants.KEY_IS_TREE_EDITOR) {{
setSelected(false); setSelected(false);
addActionListener(e -> comboBox.putClientProperty("JComboBox.isTreeCellEditor", isSelected())); addActionListener(e -> comboBox.putClientProperty(ComboBoxConstants.KEY_IS_TREE_EDITOR, isSelected()));
}}); }});
controlPanel.add(new JCheckBox("JComboBox.isTableCellEditor") {{ controlPanel.add(new JCheckBox(ComboBoxConstants.KEY_IS_TABLE_EDITOR) {{
setSelected(false); setSelected(false);
addActionListener(e -> comboBox.putClientProperty("JComboBox.isTableCellEditor", isSelected())); addActionListener(e -> comboBox.putClientProperty(ComboBoxConstants.KEY_IS_TABLE_EDITOR, isSelected()));
}}); }});
return panel; return panel;
} }

74
theme/src/main/java/com/github/weisj/darklaf/theme/OneDarkTheme.java

@ -0,0 +1,74 @@
/*
* MIT License
*
* Copyright (c) 2020 Jannis Weis
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.github.weisj.darklaf.theme;
import com.github.weisj.darklaf.theme.info.ColorToneRule;
import com.github.weisj.darklaf.theme.info.PresetIconRule;
import javax.swing.*;
import java.util.Properties;
public class OneDarkTheme extends Theme {
@Override
protected PresetIconRule getPresetIconRule() {
return PresetIconRule.NONE;
}
@Override
public String getPrefix() {
return "one_dark";
}
@Override
public String getName() {
return "One Dark";
}
@Override
protected String getResourcePath() {
return "one_dark/";
}
@Override
protected Class<? extends Theme> getLoaderClass() {
return OneDarkTheme.class;
}
@Override
public ColorToneRule getColorToneRule() {
return ColorToneRule.DARK;
}
@Override
public void customizeUIProperties(final Properties properties, final UIDefaults currentDefaults) {
super.customizeUIProperties(properties, currentDefaults);
loadCustomProperties("ui", properties, currentDefaults);
}
@Override
public void customizeIconTheme(final Properties properties, final UIDefaults currentDefaults) {
super.customizeIconTheme(properties, currentDefaults);
loadCustomProperties("icons_adjustments", properties, currentDefaults);
}
}

157
theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_defaults.properties

@ -0,0 +1,157 @@
#MIT License
#
#Copyright (c) 2020 Jannis Weis
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
#
# suppress inspection "UnusedProperty" for whole file
Theme.dark = true
Theme.highContrast = false
####Background####
%background = 21252B
%backgroundAlternative = 2C313A
%backgroundColorful = 414855
%backgroundColorfulInactive = 323844
%backgroundContainer = 21252B
%backgroundHeader = 21252B
%backgroundToolTip = 3D424B
%backgroundToolTipInactive = 3D424B
%backgroundHover = 323844
%backgroundSelected = 3D424B
%backgroundHoverSecondary = 323844
%backgroundSelectedSecondary = 3D424B
%backgroundHoverColorful = 3D424B
%backgroundSelectedColorful = 323844
%dropBackground = 323844
%dropForeground = abb2bf
####Border####
%borderSecondary = 46494F
%border = 333841
%borderTertiary = 46494F
%borderFocus = 568AF2
%gridLine = 32363C
####Highlight####
%hoverHighlight = 373A40
%clickHighlight = 3D424B
%hoverHighlightOutline = 3D424B
%clickHighlightOutline = 333841
%hoverHighlightColorful = 3D424B
%clickHighlightColorful = 333841
%hoverHighlightDefault = 7AA3F5
%clickHighlightDefault = 689/F3
%hoverHighlightSecondary = 323844
%clickHighlightSecondary = 323844
%highlightFill = 2C313A
%highlightFillFocus = 4D78CC
%highlightFillFocusSecondary = 568AF2
%highlightFillMono = 4269B9
####Widgets####
%widgetBorder = 464C55
%widgetBorderInactive = 2D3137
%widgetBorderDefault = 568AF2
%widgetFill = 333841
%widgetFillSelected = 333841
%widgetFillInactive = 21252B
%widgetFillDefault = 568AF2
####Controls####
%controlBorder = 414855
%controlBorderDisabled = 2C313A
%controlBorderSelected = 414855
%controlBorderFocus = 568AF2
%controlBorderFocusSelected = 568AF2
%controlBorderSecondary = 282B2F
%controlFill = ABB2BF
%controlFillFocus = ABB2BF
%controlFillSecondary = 568AF2
%controlTrack = 434852
%controlFillDisabled = 5C6370
%controlFillHighlight = 568AF2
%controlFillHighlightDisabled = 313469
%controlBackground = 1D1D26
%controlFadeStart = 568AF2
%controlFadeEnd = 313469
%controlErrorFadeStart = bd3c5f
%controlErrorFadeEnd = 472c33
%controlPassedFadeStart = 239E62
%controlPassedFadeEnd = 2b4242
####Text####
%caret = abb2bf
%textForeground = abb2bf
%textForegroundDefault = FFFFFF
%textForegroundHighlight = abb2bf
%textForegroundInactive = 5c6370
%textForegroundSecondary = 495162
%acceleratorForeground = E6E6E6
%textContrastForeground = FFFFFF
%textSelectionForeground = d7dae0
%textSelectionForegroundInactive = d7dae0
%textSelectionForegroundDisabled = d7dae0
%textSelectionBackground = 4d78cc
%textSelectionBackgroundSecondary = 2C313C
%textBackground = 282c34
%textBackgroundInactive = 21252B
%textBackgroundSecondary = 282C34
%textBackgroundSecondaryInactive = 282C34
%hyperlink = 6494ed
####Misc####
%shadow = 21252b
%glowOpacity = 70
%dropOpacity = 80
%shadowOpacity = 10
%glowFocus = 4e7cdb
%glowFocusInactive = 4e7cdb
%glowFocusLine = 4269b9
%glowFocusLineInactive = 4269b9
%glowError = 522530
%glowErrorLine = 692746
%glowFocusError = 802d43
%glowFocusErrorLine = 692746
%glowWarning = 8c812b
%glowWarningLine = 5f4422
#Arc
%arc = 5
%arcFocus = 5
%arcSecondary = 3
%arcSecondaryFocus = 3
%borderThickness = 3
%shadowHeight = 3

49
theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_icons.properties

@ -0,0 +1,49 @@
#MIT License
#
#Copyright (c) 2020 Jannis Weis
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
#
# suppress inspection "UnusedProperty" for whole file
%menuIconOpacity = 80
%fileIconOpacity = 80
%menuIconEnabled = AFB1B3
%menuIconHovered = F9FCFF
%menuIconSelected = F9FCFF
%menuIconSelectedSecondary = F9FCFF
%menuIconDisabled = 595959
%menuIconHighlight = 337C97
%fileIconBackground = 828D96
%fileIconForeground = 404043
%fileIconHighlight = 499C54
%textIconEnabled = abb2bf
%textIconDisabled = 5c6370
%textIconSelected = F9FCFF
%windowButton = A9A9A9
%windowButtonDisabled = 8C8C8C
%windowCloseHovered = FFFFFF
%errorIconColor = 802d43
%informationIconColor = 4269b9
%warningIconColor = 8c812b
%questionIconColor = 4269b9

27
theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_icons_adjustments.properties

@ -0,0 +1,27 @@
#MIT License
#
#Copyright (c) 2020 Jannis Weis
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#copies of the Software, and to permit persons to whom the Software is
#furnished to do so, subject to the following conditions:
#
#The above copyright notice and this permission notice shall be included in all
#copies or substantial portions of the Software.
#
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
#SOFTWARE.
#
# suppress inspection "UnusedProperty" for whole file
Icons.arrowUp.color = %textIconEnabled
Icons.arrowDown.color = %textIconEnabled
Icons.arrowLeft.color = %textIconEnabled
Icons.arrowRight.color = %textIconEnabled

337
theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_styleSheet.css

@ -0,0 +1,337 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
body {
font-size: 14pt;
font-family: Serif, serif;
font-weight: normal;
margin-left: 0;
margin-right: 0;
color: #abb2bf;
}
p {
margin-top: 15px;
}
h1 {
font-size: x-large;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
h2 {
font-size: large;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
h3 {
font-size: medium;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
h4 {
font-size: small;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
h5 {
font-size: x-small;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
h6 {
font-size: xx-small;
font-weight: bold;
margin-top: 10px;
margin-bottom: 10px;
}
li p {
margin-top: 0;
margin-bottom: 0;
}
td p {
margin-top: 0;
}
menu li p {
margin-top: 0;
margin-bottom: 0;
}
menu li {
margin: 0;
}
menu {
margin-left-ltr: 40px;
margin-right-rtl: 40px;
margin-top: 10px;
margin-bottom: 10px;
}
dir li p {
margin-top: 0;
margin-bottom: 0;
}
dir li {
margin: 0;
}
dir {
margin-left-ltr: 40px;
margin-right-rtl: 40px;
margin-top: 10px;
margin-bottom: 10px;
}
dd {
margin-left-ltr: 40px;
margin-right-rtl: 40px;
margin-top: 0;
margin-bottom: 0;
}
dd p {
margin: 0;
}
dt {
margin-top: 0;
margin-bottom: 0;
}
dl {
margin-left: 0;
margin-top: 10px;
margin-bottom: 10px;
}
ol li {
margin: 0;
}
ol {
margin-top: 10px;
margin-bottom: 10px;
margin-left-ltr: 50px;
margin-right-rtl: 50px;
list-style-type: decimal;
}
ol li p {
margin-top: 0;
margin-bottom: 0;
}
ul li {
margin: 0;
}
ul {
margin-top: 10px;
margin-bottom: 10px;
margin-left-ltr: 50px;
margin-right-rtl: 50px;
list-style-type: disc;
-bullet-gap: 10px;
}
ul li ul li {
margin: 0;
}
ul li ul {
list-style-type: circle;
margin-left-ltr: 25px;
margin-right-rtl: 25px;
}
ul li ul li ul li {
margin: 0;
}
ul li ul li ul {
list-style-type: square;
margin-left-ltr: 25px;
margin-right-rtl: 25px;
}
ul li menu {
list-style-type: circle;
margin-left-ltr: 25px;
margin-right-rtl: 25px;
}
ul li p {
margin-top: 0;
margin-bottom: 0;
}
a {
color: #6494ed;
text-decoration: underline;
}
address {
color: #6494ed;
font-style: italic;
}
big {
font-size: x-large;
}
small {
font-size: x-small;
}
samp {
font-size: small;
font-family: Monospaced, monospace;
}
cite {
font-style: italic;
}
code {
font-size: small;
font-family: Monospaced, monospace;
}
dfn {
font-style: italic;
}
em {
font-style: italic;
}
i {
font-style: italic;
}
b {
font-weight: bold;
}
kbd {
font-size: small;
font-family: Monospaced, monospace;
}
s {
text-decoration: line-through;
}
strike {
text-decoration: line-through;
}
strong {
font-weight: bold;
}
sub {
vertical-align: sub;
}
sup {
vertical-align: sub;
}
tt {
font-family: Monospaced, monospace;
}
u {
text-decoration: underline;
}
var {
font-weight: bold;
font-style: italic;
}
table {
border-color: Gray;
border-style: outset;
}
tr {
text-align: left;
}
td {
border-color: Gray;
border-style: inset;
padding: 3px;
}
th {
text-align: center;
font-weight: bold;
border-color: Gray;
border-style: inset;
padding: 3px;
}
blockquote {
margin: 5px 35px;
}
center {
text-align: center;
}
pre {
margin-top: 5px;
margin-bottom: 5px;
font-family: Monospaced, monospace;
}
pre p {
margin-top: 0;
}
caption {
caption-side: top;
text-align: center;
}
table {
border: none;
}
td {
border: none;
}
nobr {
white-space: nowrap;
}

37
theme/src/main/resources/com/github/weisj/darklaf/theme/one_dark/one_dark_ui.properties

@ -0,0 +1,37 @@
#
# MIT License
#
# Copyright (c) 2020 Jannis Weis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
CheckBox.activeFillColor = %textBackground
CheckBox.selectedFillColor = %textBackground
Slider.activeThumbFill = %textBackground
RadioButton.activeFillColor = %textBackground
ScrollBar.fadeStartColor = 676A71
ScrollBar.fadeEndColor = 797E85
Menu.selectionBackground = %backgroundColorfulInactive
MenuItem.selectionBackground = %backgroundColorfulInactive
RadioButtonMenuItem.selectionBackground = %backgroundColorfulInactive
CheckBoxMenuItem.selectionBackground = %backgroundColorfulInactive
TristateCheckBoxMenuItem.selectionBackground = %backgroundColorfulInactive
ComboBox.selectionBackground = %backgroundColorfulInactive
TabFramePopup.headerHoverBackground = %backgroundHoverColorful
TabFramePopup.headerSelectedHoverBackground = %backgroundHoverColorful
Loading…
Cancel
Save