|
| 1 | +/* |
| 2 | + * Minecraft Development for IntelliJ |
| 3 | + * |
| 4 | + * https://mcdev.io/ |
| 5 | + * |
| 6 | + * Copyright (C) 2025 minecraft-dev |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU Lesser General Public License as published |
| 10 | + * by the Free Software Foundation, version 3.0 only. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU Lesser General Public License |
| 18 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +package com.demonwav.mcdev.platform.mixin.expression.gui |
| 22 | + |
| 23 | +import com.intellij.openapi.editor.colors.EditorColorsManager |
| 24 | +import com.intellij.openapi.editor.colors.EditorFontType |
| 25 | +import com.intellij.ui.JBColor |
| 26 | +import com.intellij.util.ui.JBUI |
| 27 | +import com.intellij.util.ui.UIUtil |
| 28 | +import com.mxgraph.util.mxConstants |
| 29 | +import java.awt.Color |
| 30 | + |
| 31 | +object DiagramStyles { |
| 32 | + val DEFAULT_NODE |
| 33 | + get() = mapOf( |
| 34 | + mxConstants.STYLE_FONTFAMILY to CURRENT_EDITOR_FONT.family, |
| 35 | + mxConstants.STYLE_ROUNDED to true, |
| 36 | + mxConstants.STYLE_FILLCOLOR to JBUI.CurrentTheme.Button.buttonColorStart().hexString, |
| 37 | + mxConstants.STYLE_FONTCOLOR to UIUtil.getLabelForeground().hexString, |
| 38 | + mxConstants.STYLE_STROKECOLOR to JBUI.CurrentTheme.Button.buttonOutlineColorStart(false).hexString, |
| 39 | + mxConstants.STYLE_ALIGN to mxConstants.ALIGN_CENTER, |
| 40 | + mxConstants.STYLE_VERTICAL_ALIGN to mxConstants.ALIGN_TOP, |
| 41 | + mxConstants.STYLE_SHAPE to mxConstants.SHAPE_LABEL, |
| 42 | + mxConstants.STYLE_SPACING to 5, |
| 43 | + mxConstants.STYLE_SPACING_TOP to 3, |
| 44 | + ) |
| 45 | + val DEFAULT_EDGE |
| 46 | + get() = mapOf( |
| 47 | + mxConstants.STYLE_STROKECOLOR to UIUtil.getFocusedBorderColor().hexString, |
| 48 | + ) |
| 49 | + val LINE_NUMBER = mapOf( |
| 50 | + mxConstants.STYLE_FONTSIZE to "16", |
| 51 | + mxConstants.STYLE_STROKECOLOR to "none", |
| 52 | + mxConstants.STYLE_FILLCOLOR to "none", |
| 53 | + ) |
| 54 | + val SEARCH_HIGHLIGHT |
| 55 | + get() = mapOf( |
| 56 | + mxConstants.STYLE_STROKECOLOR to UIUtil.getFocusedBorderColor().hexString, |
| 57 | + mxConstants.STYLE_STROKEWIDTH to "2", |
| 58 | + ) |
| 59 | + val IGNORED = mapOf( |
| 60 | + mxConstants.STYLE_OPACITY to 20, |
| 61 | + mxConstants.STYLE_TEXT_OPACITY to 20, |
| 62 | + mxConstants.STYLE_STROKE_OPACITY to 20, |
| 63 | + mxConstants.STYLE_FILL_OPACITY to 20, |
| 64 | + ) |
| 65 | + val FAILED |
| 66 | + get() = mapOf( |
| 67 | + mxConstants.STYLE_STROKECOLOR to JBColor.red.hexString, |
| 68 | + mxConstants.STYLE_STROKEWIDTH to "3.5", |
| 69 | + ) |
| 70 | + val PARTIAL_MATCH |
| 71 | + get() = mapOf( |
| 72 | + mxConstants.STYLE_STROKECOLOR to JBColor.orange.hexString, |
| 73 | + mxConstants.STYLE_STROKEWIDTH to "2.5", |
| 74 | + ) |
| 75 | + val SUCCESS |
| 76 | + get() = mapOf( |
| 77 | + mxConstants.STYLE_STROKECOLOR to JBColor.green.hexString, |
| 78 | + mxConstants.STYLE_STROKEWIDTH to "1.5", |
| 79 | + ) |
| 80 | + val CURRENT_EDITOR_FONT |
| 81 | + get() = EditorColorsManager.getInstance().globalScheme.getFont(EditorFontType.PLAIN) |
| 82 | +} |
| 83 | + |
| 84 | +private val Color.hexString get() = "#%06X".format(rgb) |
0 commit comments