1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-12-22 10:59:01 +00:00

Improve theme support

This commit is contained in:
Arnaud Roques 2021-05-06 23:23:05 +02:00
parent 1048a07d7d
commit c216d071b5
239 changed files with 1437 additions and 837 deletions

View File

@ -21,6 +21,7 @@ package jcckit.util;
import java.awt.Color;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
import net.sourceforge.plantuml.ugraphic.color.NoSuchColorException;
@ -305,7 +306,7 @@ static private HColorSet colors = HColorSet.instance();
private Color decodeInternal(String value) {
if (value!=null) {
try {
return new ColorMapperIdentity().toColor(colors.getColor(value, null));
return new ColorMapperIdentity().toColor(colors.getColor(ThemeStyle.LIGHT, value, null));
} catch (NoSuchColorException e) {
return Color.WHITE;
}

View File

@ -48,12 +48,15 @@ import java.util.List;
import net.sourceforge.plantuml.cucadiagram.dot.GraphvizUtils;
import net.sourceforge.plantuml.ugraphic.UAntiAliasing;
import net.sourceforge.plantuml.ugraphic.color.ColorMapperIdentity;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorSimple;
import net.sourceforge.plantuml.ugraphic.g2d.UGraphicG2d;
public class EmptyImageBuilder {
private final BufferedImage im;
private final Graphics2D g2d;
private final Color background;
public EmptyImageBuilder(String watermark, double width, double height, Color background) {
this(watermark, (int) width, (int) height, background);
@ -68,6 +71,7 @@ public class EmptyImageBuilder {
Log.info("Height too large " + height + ". You should set PLANTUML_LIMIT_SIZE");
height = GraphvizUtils.getenvImageLimit();
}
this.background = background;
Log.info("Creating image " + width + "x" + height);
im = new BufferedImage(width, height, getType(background));
g2d = im.createGraphics();
@ -161,7 +165,8 @@ public class EmptyImageBuilder {
}
public UGraphicG2d getUGraphicG2d() {
final UGraphicG2d result = new UGraphicG2d(new ColorMapperIdentity(), g2d, 1.0);
final HColor back = new HColorSimple(background, false);
final UGraphicG2d result = new UGraphicG2d(back, new ColorMapperIdentity(), g2d, 1.0);
result.setBufferedImage(im);
return result;
}

View File

@ -191,8 +191,9 @@ public interface ISkinParam extends ISkinSimple {
public ActorStyle actorStyle();
public void setSvgSize(String origin, String sizeToUse);
public LengthAdjust getlengthAdjust();
public void assumeTransparent(ThemeStyle style);
}

View File

@ -333,8 +333,8 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype);
for (String s : stereotype.getMultipleLabels()) {
final String value2 = getValue(param.name() + "color" + "<<" + s + ">>");
if (value2 != null && getIHtmlColorSet().getColorOrWhite(value2) != null) {
return getIHtmlColorSet().getColorOrWhite(value2);
if (value2 != null && getIHtmlColorSet().getColorOrWhite(themeStyle, value2) != null) {
return getIHtmlColorSet().getColorOrWhite(themeStyle, value2);
}
}
}
@ -347,12 +347,12 @@ public class SkinParam implements ISkinParam {
return HColorUtils.transparent();
}
if (param == ColorParam.background) {
return getIHtmlColorSet().getColorOrWhite(value);
return getIHtmlColorSet().getColorOrWhite(themeStyle, value);
}
assert param != ColorParam.background;
// final boolean acceptTransparent = param == ColorParam.background
// || param == ColorParam.sequenceGroupBodyBackground || param == ColorParam.sequenceBoxBackground;
return getIHtmlColorSet().getColorOrWhite(value, getBackgroundColor(false));
return getIHtmlColorSet().getColorOrWhite(themeStyle, value, getBackgroundColor(false));
}
public char getCircledCharacter(Stereotype stereotype) {
@ -371,14 +371,14 @@ public class SkinParam implements ISkinParam {
checkStereotype(stereotype);
final String value2 = getValue(param.name() + "color" + stereotype.getLabel(Guillemet.DOUBLE_COMPARATOR));
if (value2 != null) {
return new Colors(value2, getIHtmlColorSet(), param.getColorType());
return new Colors(themeStyle, value2, getIHtmlColorSet(), param.getColorType());
}
}
final String value = getValue(getParamName(param, false));
if (value == null) {
return Colors.empty();
}
return new Colors(value, getIHtmlColorSet(), param.getColorType());
return new Colors(themeStyle, value, getIHtmlColorSet(), param.getColorType());
}
private String getParamName(ColorParam param, boolean clickable) {
@ -459,7 +459,7 @@ public class SkinParam implements ISkinParam {
if (value == null) {
return null;
}
return getIHtmlColorSet().getColorOrWhite(value);
return getIHtmlColorSet().getColorOrWhite(themeStyle, value);
}
private String getFirstValueNonNullWithSuffix(String suffix, FontParam... param) {
@ -840,7 +840,7 @@ public class SkinParam implements ISkinParam {
}
return swimlanes();
}
public boolean swimlanes() {
return isTrue("swimlane") || isTrue("swimlanes");
}
@ -1066,8 +1066,8 @@ public class SkinParam implements ISkinParam {
public SplitParam getSplitParam() {
final String border = getValue("pageBorderColor");
final String external = getValue("pageExternalColor");
final HColor borderColor = border == null ? null : getIHtmlColorSet().getColorOrWhite(border);
final HColor externalColor = external == null ? null : getIHtmlColorSet().getColorOrWhite(external);
final HColor borderColor = border == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, border);
final HColor externalColor = external == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, external);
int margin = getAsInt("pageMargin", 0);
return new SplitParam(borderColor, externalColor, margin);
}
@ -1092,7 +1092,7 @@ public class SkinParam implements ISkinParam {
if (value == null) {
return null;
}
return getIHtmlColorSet().getColorOrWhite(value, null);
return getIHtmlColorSet().getColorOrWhite(themeStyle, value, null);
}
public double getPadding() {
@ -1162,8 +1162,9 @@ public class SkinParam implements ISkinParam {
if (padding == 0 && margin == 0 && borderColor == null && backgroundColor == null) {
return Padder.NONE;
}
final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(borderColor);
final HColor background = backgroundColor == null ? null : getIHtmlColorSet().getColorOrWhite(backgroundColor);
final HColor border = borderColor == null ? null : getIHtmlColorSet().getColorOrWhite(themeStyle, borderColor);
final HColor background = backgroundColor == null ? null
: getIHtmlColorSet().getColorOrWhite(themeStyle, backgroundColor);
final double roundCorner = getRoundCorner(CornerParam.DEFAULT, null);
return Padder.NONE.withMargin(margin).withPadding(padding).withBackgroundColor(background)
.withBorderColor(border).withRoundCorner(roundCorner);
@ -1206,4 +1207,14 @@ public class SkinParam implements ISkinParam {
return LengthAdjust.defaultValue();
}
private ThemeStyle themeStyle = ThemeStyle.LIGHT;
public void assumeTransparent(ThemeStyle style) {
this.themeStyle = style;
}
public ThemeStyle getThemeStyle() {
return themeStyle;
}
}

View File

@ -378,4 +378,12 @@ public class SkinParamDelegator implements ISkinParam {
return skinParam.getlengthAdjust();
}
public void assumeTransparent(ThemeStyle style) {
skinParam.assumeTransparent(style);
}
public ThemeStyle getThemeStyle() {
return skinParam.getThemeStyle();
}
}

View File

@ -42,5 +42,7 @@ public interface SpriteContainer extends SvgCharSizeHack {
public Sprite getSprite(String name);
public Guillemet guillemet();
public ThemeStyle getThemeStyle();
}

View File

@ -102,4 +102,8 @@ public class SpriteContainerEmpty implements SpriteContainer, ISkinSimple {
return s;
}
public ThemeStyle getThemeStyle() {
return ThemeStyle.LIGHT;
}
}

View File

@ -0,0 +1,42 @@
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
* If you like this project or if you find it useful, you can support us at:
*
* http://plantuml.com/patreon (only 1$ per month!)
* http://plantuml.com/paypal
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
* License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*
*
*/
package net.sourceforge.plantuml;
public enum ThemeStyle {
DARK, LIGHT
}

View File

@ -50,8 +50,14 @@ import net.sourceforge.plantuml.graphic.HorizontalAlignment;
import net.sourceforge.plantuml.graphic.VerticalAlignment;
import net.sourceforge.plantuml.sprite.Sprite;
import net.sourceforge.plantuml.style.ClockwiseTopRightBottomLeft;
import net.sourceforge.plantuml.style.PName;
import net.sourceforge.plantuml.style.SName;
import net.sourceforge.plantuml.style.Style;
import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.ImageBuilder;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public abstract class TitledDiagram extends AbstractPSystem implements Diagram, Annotated {
@ -248,4 +254,21 @@ public abstract class TitledDiagram extends AbstractPSystem implements Diagram,
public ImageBuilder createImageBuilder(FileFormatOption fileFormatOption) throws IOException {
return super.createImageBuilder(fileFormatOption).styled(this);
}
public HColor calculateBackColor() {
if (UseStyle.useBetaStyle()) {
final Style style = StyleSignature.of(SName.root, SName.document, this.getUmlDiagramType().getStyleName())
.getMergedStyle(this.getSkinParam().getCurrentStyleBuilder());
HColor backgroundColor = style.value(PName.BackGroundColor).asColor(this.getSkinParam().getThemeStyle(),
this.getSkinParam().getIHtmlColorSet());
if (backgroundColor == null) {
backgroundColor = HColorUtils.transparent();
}
return backgroundColor;
}
return this.getSkinParam().getBackgroundColor(false);
}
}

View File

@ -133,7 +133,7 @@ public class CommandIf extends SingleLineCommand2<ActivityDiagram> {
}
}
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
diagram.addLink(link);
return CommandExecutionResult.ok();

View File

@ -122,7 +122,8 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final IEntity entity1 = getEntity(diagram, arg, true);
if (entity1 == null) {
return CommandExecutionResult.error("No such activity");
@ -133,7 +134,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (arg.get("BACKCOLOR", 0) != null) {
String s = arg.get("BACKCOLOR", 0);
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
final IEntity entity2 = getEntity(diagram, arg, false);
@ -143,7 +144,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
if (arg.get("BACKCOLOR2", 0) != null) {
String s = arg.get("BACKCOLOR2", 0);
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
if (arg.get("STEREOTYPE2", 0) != null) {
entity2.setStereotype(new Stereotype(arg.get("STEREOTYPE2", 0)));
@ -181,7 +182,7 @@ public class CommandLinkActivity extends SingleLineCommand2<ActivityDiagram> {
link.setUrl(urlLink);
}
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
diagram.addLink(link);
return CommandExecutionResult.ok();

View File

@ -115,7 +115,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
}
@Override
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines)
throws NoSuchColorException {
lines = lines.trim();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
@ -129,8 +130,8 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
}
final String stringColor = line0.get("BACKCOLOR", 0);
if (stringColor != null) {
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(stringColor));
entity1.setSpecificColorTOBEREMOVED(ColorType.BACK, diagram.getSkinParam().getIHtmlColorSet()
.getColor(diagram.getSkinParam().getThemeStyle(), stringColor));
}
final StringBuilder sb = new StringBuilder();
@ -200,7 +201,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
if (lineLast.get(4) != null) {
String s = lineLast.get(4);
entity2.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(s));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
}
final String arrowBody1 = CommandLinkClass.notNull(line0.get("ARROW_BODY1", 0));
@ -230,7 +231,7 @@ public class CommandLinkLongActivity extends CommandMultilines2<ActivityDiagram>
link.setUrl(urlLink);
}
link.applyStyle(line0.getLazzy("ARROW_STYLE", 0));
link.applyStyle(diagram.getSkinParam().getThemeStyle(), line0.getLazzy("ARROW_STYLE", 0));
diagram.addLink(link);
return CommandExecutionResult.ok();

View File

@ -85,7 +85,8 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
@ -94,7 +95,8 @@ public class CommandPartition extends SingleLineCommand2<ActivityDiagram> {
NamespaceStrategy.SINGLE);
final IEntity p = diagram.getCurrentGroup();
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
if (colors.isEmpty() == false) {
p.setColors(colors);
}

View File

@ -96,7 +96,8 @@ public class Branch {
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionDiamond().getMergedStyle(styleBuilder);
this.color = color == null
? style.value(PName.BackGroundColor).asColor(styleBuilder.getSkinParam().getIHtmlColorSet())
? style.value(PName.BackGroundColor).asColor(styleBuilder.getSkinParam().getThemeStyle(),
styleBuilder.getSkinParam().getIHtmlColorSet())
: color;
} else {
this.color = color;

View File

@ -113,7 +113,8 @@ public class CommandActivity3 extends SingleLineCommand2<ActivityDiagram3> {
url = urlBuilder.getUrl(arg.get("URL", 0));
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String stereo = arg.get("STEREO", 0);
Stereotype stereotype = null;
if (stereo != null) {

View File

@ -77,8 +77,11 @@ public class CommandActivityLong3 extends CommandMultilines2<ActivityDiagram3> {
protected CommandExecutionResult executeNow(ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
lines = lines.removeEmptyColumns();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
// final HtmlColor color = diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0));
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
// final HtmlColor color =
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0));
final BoxStyle style = BoxStyle.fromChar(lines.getLastChar());
lines = lines.removeStartingAndEnding(line0.get("DATA", 0), 1);
diagram.addActivity(lines.toDisplay(), style, null, colors, null);

View File

@ -62,9 +62,11 @@ public class CommandCircleSpot3 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
diagram.addSpot(arg.get("SPOT", 0), color);
return CommandExecutionResult.ok();
}

View File

@ -96,9 +96,11 @@ public class CommandElseIf2 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
String test = arg.get("TEST", 0);
if (test.length() == 0) {

View File

@ -79,9 +79,11 @@ public class CommandIf2 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
String test = arg.get("TEST", 0);
if (test.length() == 0) {

View File

@ -76,9 +76,11 @@ public class CommandIf4 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
String test = arg.get("TEST", 0);
if (test.length() == 0) {

View File

@ -63,9 +63,11 @@ public class CommandLink3 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
if (color != null) {
diagram.setColorNextArrow(Rainbow.fromColor(color, null));
}

View File

@ -76,8 +76,10 @@ public class CommandNote3 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final Display note = Display.getWithNewlines(arg.get("NOTE", 0));
final NotePosition position = NotePosition.defaultLeft(arg.get("POSITION", 0));
final NoteType type = NoteType.defaultType(arg.get("TYPE", 0));

View File

@ -68,15 +68,18 @@ public class CommandNoteLong3 extends CommandMultilines2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines) throws NoSuchColorException {
// final List<? extends CharSequence> in = StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1));
protected CommandExecutionResult executeNow(final ActivityDiagram3 diagram, BlocLines lines)
throws NoSuchColorException {
// final List<? extends CharSequence> in =
// StringUtils.removeEmptyColumns2(lines.subList(1, lines.size() - 1));
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
final NotePosition position = NotePosition.defaultLeft(line0.get("POSITION", 0));
final NoteType type = NoteType.defaultType(line0.get("TYPE", 0));
final Display note = lines.toDisplay();
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
return diagram.addNote(note, position, type, colors);
}

View File

@ -73,7 +73,7 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
RegexLeaf.spaceOneOrMore(), //
new RegexOptional(//
new RegexConcat( //
color("BACK1").getRegex(),//
color("BACK1").getRegex(), //
RegexLeaf.spaceOneOrMore())), //
new RegexLeaf("NAME", "([%g][^%g]+[%g]|\\S+)"), //
new RegexOptional(//
@ -119,19 +119,20 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String partitionTitle = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
final String b1 = arg.get("BACK1", 0);
final Colors colors = color(b1 == null ? "BACK2" : "BACK1").getColor(arg,
diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color(b1 == null ? "BACK2" : "BACK1").getColor(diagram.getSkinParam().getThemeStyle(),
arg, diagram.getSkinParam().getIHtmlColorSet());
final USymbol symbol = getUSymbol(arg.get("TYPE", 0));
final String stereo = arg.get("STEREO", 0);
final Stereotype stereotype = stereo == null ? null : new Stereotype(stereo);
final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol),
stereotype, false);
final HColor backColorInSkinparam = diagram.getSkinParam().getHtmlColor(getColorParamBack(symbol), stereotype,
false);
HColor backColor;
if (backColorInSkinparam == null) {
backColor = colors.getColor(ColorType.BACK);
@ -148,12 +149,13 @@ public class CommandPartition3 extends SingleLineCommand2<ActivityDiagram3> {
double roundCorner = symbol.getSkinParameter().getRoundCorner(diagram.getSkinParam(), stereotype);
if (UseStyle.useBetaStyle()) {
final Style stylePartition = getDefaultStyleDefinitionPartition().getMergedStyle(
diagram.getSkinParam().getCurrentStyleBuilder());
borderColor = stylePartition.value(PName.LineColor).asColor(diagram.getSkinParam().getIHtmlColorSet());
final Style stylePartition = getDefaultStyleDefinitionPartition()
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
borderColor = stylePartition.value(PName.LineColor).asColor(diagram.getSkinParam().getThemeStyle(),
diagram.getSkinParam().getIHtmlColorSet());
backColor = colors.getColor(ColorType.BACK);
if (backColor == null) {
backColor = stylePartition.value(PName.BackGroundColor).asColor(
backColor = stylePartition.value(PName.BackGroundColor).asColor(diagram.getSkinParam().getThemeStyle(),
diagram.getSkinParam().getIHtmlColorSet());
}
titleColor = HColorUtils.BLUE;// stylePartition.value(PName.FontColor).asColor(diagram.getSkinParam().getIHtmlColorSet());

View File

@ -77,9 +77,11 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
final BoxStyle boxStyle;
final String styleString = arg.get("STYLE", 0);
@ -88,7 +90,8 @@ public class CommandRepeat3 extends SingleLineCommand2<ActivityDiagram3> {
} else {
boxStyle = BoxStyle.fromChar(styleString.charAt(0));
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String stereo = arg.get("STEREO", 0);
if (stereo != null) {
final Stereotype stereotype = new Stereotype(stereo);

View File

@ -65,9 +65,11 @@ public class CommandSwimlane extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
final String name = arg.get("SWIMLANE", 0);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
return diagram.swimlane(name, color, label);

View File

@ -73,9 +73,11 @@ public class CommandSwimlane2 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
final String name = arg.get("SWIMLANE", 0);
final Display label = Display.getWithNewlines(arg.get("LABEL", 0));
return diagram.swimlane(name, color, label);

View File

@ -67,9 +67,11 @@ public class CommandSwitch extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
String test = arg.get("TEST", 0);
if (test.length() == 0) {

View File

@ -73,9 +73,11 @@ public class CommandWhile3 extends SingleLineCommand2<ActivityDiagram3> {
}
@Override
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ActivityDiagram3 diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
final HColor color = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor color = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
diagram.doWhile(Display.getWithNewlines(arg.get("TEST", 0)), Display.getWithNewlines(arg.get("YES", 0)), color);
return CommandExecutionResult.ok();

View File

@ -88,7 +88,7 @@ public class FtileFactoryDelegator implements FtileFactory {
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
return Rainbow.build(style, skinParam().getIHtmlColorSet());
return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
color = Rainbow.build(skinParam());
}
@ -99,7 +99,7 @@ public class FtileFactoryDelegator implements FtileFactory {
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
return Rainbow.build(style, skinParam().getIHtmlColorSet());
return Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
color = Rainbow.build(skinParam());
}
@ -115,7 +115,7 @@ public class FtileFactoryDelegator implements FtileFactory {
final FontConfiguration fontConfiguration;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
fontConfiguration = style.getFontConfiguration(skinParam().getIHtmlColorSet());
fontConfiguration = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
} else {
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}

View File

@ -100,7 +100,7 @@ public class LaneDivider extends AbstractTextBlock {
}
UStroke thickness = Rose.getStroke(skinParam, LineParam.swimlaneBorder, 2);
if (UseStyle.useBetaStyle()) {
color = getStyle().value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
color = getStyle().value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
thickness = getStyle().getStroke();
}
ug.apply(UTranslate.dx(x1)).apply(thickness).apply(color).draw(ULine.vline(height));

View File

@ -229,7 +229,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
final HorizontalAlignment horizontalAlignment = HorizontalAlignment.LEFT;
FontConfiguration fontConfiguration = new FontConfiguration(skinParam, FontParam.SWIMLANE_TITLE, null);
if (UseStyle.useBetaStyle()) {
fontConfiguration = getStyle().getFontConfiguration(skinParam.getIHtmlColorSet());
fontConfiguration = getStyle().getFontConfiguration(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
}
LineBreakStrategy wrap = getWrap();
if (wrap.isAuto()) {
@ -303,7 +304,8 @@ public class Swimlanes extends AbstractTextBlock implements TextBlock, Styleable
private void drawTitlesBackground(UGraphic ug) {
HColor color = skinParam.getHtmlColor(ColorParam.swimlaneTitleBackground, null, false);
if (UseStyle.useBetaStyle()) {
color = getStyle().value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
color = getStyle().value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
}
if (color != null) {
final double titleHeight = getTitlesHeight(ug.getStringBounder());

View File

@ -137,7 +137,7 @@ public abstract class AbstractParallelFtilesBuilder {
final FontConfiguration fontConfiguration;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
fontConfiguration = style.getFontConfiguration(skinParam().getIHtmlColorSet());
fontConfiguration = style.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
} else {
fontConfiguration = new FontConfiguration(skinParam(), FontParam.ARROW, null);
}

View File

@ -82,20 +82,22 @@ public class FtileFactoryDelegatorIf extends FtileFactoryDelegator {
: FontParam.ARROW;
final FontConfiguration fcArrow;
if (UseStyle.useBetaStyle()) {
final Style styleArrow = getDefaultStyleDefinitionArrow().getMergedStyle(
skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond().getMergedStyle(
skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
backColor = branch0.getColor() == null ? styleDiamond.value(PName.BackGroundColor).asColor(
skinParam().getIHtmlColorSet()) : branch0.getColor();
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
final Style styleArrow = getDefaultStyleDefinitionArrow()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
skinParam().getIHtmlColorSet());
backColor = branch0.getColor() == null ? styleDiamond.value(PName.BackGroundColor)
.asColor(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet()) : branch0.getColor();
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
fcTest = styleDiamond.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
fcArrow = styleArrow.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
backColor = branch0.getColor() == null ? getRose().getHtmlColor(skinParam(),
ColorParam.activityDiamondBackground) : branch0.getColor();
backColor = branch0.getColor() == null
? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)
: branch0.getColor();
arrowColor = Rainbow.build(skinParam());
fcTest = new FontConfiguration(skinParam(), testParam, null)
.changeColor(fontColor(FontParam.ACTIVITY_DIAMOND));

View File

@ -90,11 +90,13 @@ public class FtileFactoryDelegatorRepeat extends FtileFactoryDelegator {
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
diamondColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
fcDiamond = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
fcArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
skinParam().getIHtmlColorSet());
diamondColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getThemeStyle(),
skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
fcDiamond = styleDiamond.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
fcArrow = styleArrow.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
// diamondColor = color == null ? getRose().getHtmlColor(skinParam(),

View File

@ -87,11 +87,13 @@ public class FtileFactoryDelegatorWhile extends FtileFactoryDelegator {
.getMergedStyle(skinParam().getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam().getCurrentStyleBuilder());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getIHtmlColorSet());
backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet());
fontArrow = styleArrow.getFontConfiguration(skinParam().getIHtmlColorSet());
fcTest = styleDiamond.getFontConfiguration(skinParam().getIHtmlColorSet());
borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam().getThemeStyle(),
skinParam().getIHtmlColorSet());
backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam().getThemeStyle(),
skinParam().getIHtmlColorSet());
arrowColor = Rainbow.build(styleArrow, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
fontArrow = styleArrow.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
fcTest = styleDiamond.getFontConfiguration(skinParam().getThemeStyle(), skinParam().getIHtmlColorSet());
} else {
borderColor = getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBorder);
backColor = color == null ? getRose().getHtmlColor(skinParam(), ColorParam.activityDiamondBackground)

View File

@ -104,7 +104,7 @@ public class FtileGroup extends AbstractFtile {
final Style style;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionPartition().getMergedStyle(skinParam.getCurrentStyleBuilder());
fc = style.getFontConfiguration(getIHtmlColorSet());
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
style = null;

View File

@ -113,8 +113,9 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable
final LineBreakStrategy wrapWidth;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
shadowing = style.value(PName.Shadowing).asDouble();
wrapWidth = style.wrapWidth();
} else {
@ -129,8 +130,8 @@ public class FtileNoteAlone extends AbstractFtile implements Stencil, Styleable
final Sheet sheet = Parser
.build(fc, skinParam.getDefaultTextAlignment(HorizontalAlignment.LEFT), skinParam, CreoleMode.FULL)
.createSheet(note);
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()),
this, new UStroke(1));
final TextBlock text = new SheetBlock2(new SheetBlock1(sheet, wrapWidth, skinParam.getPadding()), this,
new UStroke(1));
opale = new Opale(shadowing, borderColor, noteBackgroundColor, text, false);
}

View File

@ -148,9 +148,10 @@ public class FtileWithNoteOpale extends AbstractFtile implements Stencil, Stylea
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder())
.eventuallyOverride(note.getColors());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
fc = style.getFontConfiguration(getIHtmlColorSet());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
shadowing = style.value(PName.Shadowing).asDouble();
wrapWidth = style.wrapWidth();
} else {

View File

@ -119,9 +119,10 @@ public class FtileWithNotes extends AbstractFtile {
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder())
.eventuallyOverride(note.getColors());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
fc = style.getFontConfiguration(getIHtmlColorSet());
noteBackgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
shadowing = style.value(PName.Shadowing).asDouble();
wrapWidth = style.wrapWidth();
} else {

View File

@ -138,7 +138,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
final Rainbow def;
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
def = Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
def = Rainbow.build(skinParam());
}
@ -203,7 +203,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
final Rainbow def;
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
def = Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
def = Rainbow.build(skinParam());
}
@ -248,8 +248,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
final Point2D p1 = new Point2D.Double(geo2.getLeft(), 0);
final Point2D p2 = new Point2D.Double(geo2.getLeft(), geo2.getInY());
Snake snake = Snake.create(arrowColor, Arrows.asToDown())
.ignoreForCompression();
Snake snake = Snake.create(arrowColor, Arrows.asToDown()).ignoreForCompression();
if (Display.isNull(label) == false) {
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
}
@ -305,8 +304,7 @@ public class ParallelBuilderFork extends AbstractParallelFtilesBuilder {
final Point2D p1 = new Point2D.Double(geo.getLeft(), barHeight + geo.getOutY());
final Point2D p2 = new Point2D.Double(geo.getLeft(), justBeforeBar2);
Snake snake = Snake.create(arrowColor, Arrows.asToDown())
.ignoreForCompression();
Snake snake = Snake.create(arrowColor, Arrows.asToDown()).ignoreForCompression();
if (Display.isNull(label) == false) {
snake = snake.withLabel(getTextBlock(label), arrowHorizontalAlignment());
}

View File

@ -82,7 +82,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
final Rainbow def;
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
def = Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
def = Rainbow.build(skinParam());
}
@ -114,7 +114,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
final Rainbow def;
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
def = Rainbow.build(style, skinParam().getIHtmlColorSet());
def = Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
def = Rainbow.build(skinParam());
}
@ -126,7 +126,7 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
return FtileUtils.addConnection(result, conns);
}
class ConnectionHorizontalThenVertical extends AbstractConnection /* implements ConnectionTranslatable */{
class ConnectionHorizontalThenVertical extends AbstractConnection /* implements ConnectionTranslatable */ {
private final Rainbow arrowColor;
private final UTranslate diamondTranslate;
@ -170,8 +170,8 @@ public class ParallelBuilderMerge extends AbstractParallelFtilesBuilder {
}
private Point2D getP2(final StringBounder stringBounder) {
final Point2D result = diamondTranslate.getTranslated(getFtile2().calculateDimension(stringBounder)
.getPointOut());
final Point2D result = diamondTranslate
.getTranslated(getFtile2().calculateDimension(stringBounder).getPointOut());
final Dimension2D dim = getFtile2().calculateDimension(stringBounder);
UTranslate arrival = new UTranslate();
if (counter == 0) {

View File

@ -81,7 +81,7 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
final Rainbow thinColor;
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
thinColor = Rainbow.build(style, skinParam().getIHtmlColorSet());
thinColor = Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle());
} else {
thinColor = result.getInLinkRendering().getRainbow(Rainbow.build(skinParam()));
}
@ -100,7 +100,8 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
final Rainbow rainbow;
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
rainbow = inLinkRendering
.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle()));
} else {
rainbow = inLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
@ -128,7 +129,8 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
final LinkRendering inLinkRendering = tmp.getInLinkRendering();
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
rainbow = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
rainbow = inLinkRendering
.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle()));
} else {
rainbow = inLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
@ -161,7 +163,8 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
final LinkRendering inLinkRendering = result.getInLinkRendering();
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
thinColor = inLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
thinColor = inLinkRendering
.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle()));
} else {
thinColor = inLinkRendering.getRainbow(Rainbow.build(skinParam()));
}
@ -186,7 +189,8 @@ public class ParallelBuilderSplit extends AbstractParallelFtilesBuilder {
final LinkRendering outLinkRendering = tmp.getOutLinkRendering();
if (UseStyle.useBetaStyle()) {
Style style = getDefaultStyleDefinition().getMergedStyle(skinParam().getCurrentStyleBuilder());
rainbow = outLinkRendering.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet()));
rainbow = outLinkRendering
.getRainbow(Rainbow.build(style, skinParam().getIHtmlColorSet(), skinParam().getThemeStyle()));
} else {
rainbow = outLinkRendering.getRainbow(Rainbow.build(skinParam()));
}

View File

@ -74,7 +74,6 @@ import net.sourceforge.plantuml.style.StyleBuilder;
import net.sourceforge.plantuml.style.StyleSignature;
import net.sourceforge.plantuml.ugraphic.UFont;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import net.sourceforge.plantuml.ugraphic.color.HColorUtils;
public class VCompactFactory implements FtileFactory {
@ -104,7 +103,7 @@ public class VCompactFactory implements FtileFactory {
Style style = null;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
color = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
color = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {
color = rose.getHtmlColor(skinParam, ColorParam.activityStart);
}
@ -117,8 +116,9 @@ public class VCompactFactory implements FtileFactory {
final HColor backgroundColor;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
// backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false);
} else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);
@ -140,8 +140,9 @@ public class VCompactFactory implements FtileFactory {
final HColor backgroundColor;
if (UseStyle.useBetaStyle()) {
style = getDefaultStyleDefinitionCircle().getMergedStyle(skinParam.getCurrentStyleBuilder());
borderColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
// backgroundColor = style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
// backgroundColor =
// style.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
backgroundColor = skinParam.getBackgroundColor(false);
} else {
borderColor = rose.getHtmlColor(skinParam, ColorParam.activityEnd);

View File

@ -110,12 +110,15 @@ public class ConditionalBuilder {
.getMergedStyle(skinParam.getCurrentStyleBuilder());
final Style styleDiamond = getDefaultStyleDefinitionDiamond()
.getMergedStyle(skinParam.getCurrentStyleBuilder());
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getIHtmlColorSet());
this.arrowColor = Rainbow.fromColor(styleArrow.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet()),
this.borderColor = styleDiamond.value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
this.backColor = styleDiamond.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
this.arrowColor = Rainbow.fromColor(
styleArrow.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()),
null);
this.fontTest = styleDiamond.getFontConfiguration(skinParam.getIHtmlColorSet());
this.fontArrow = styleArrow.getFontConfiguration(skinParam.getIHtmlColorSet());
this.fontTest = styleDiamond.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
this.fontArrow = styleArrow.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {
this.borderColor = borderColor;
this.backColor = backColor;

View File

@ -187,15 +187,16 @@ public class FtileBox extends AbstractFtile {
final FontConfiguration fc;
final LineBreakStrategy wrapWidth;
if (UseStyle.useBetaStyle()) {
this.inRendering = new LinkRendering(Rainbow.build(styleArrow, getIHtmlColorSet()));
this.inRendering = new LinkRendering(
Rainbow.build(styleArrow, getIHtmlColorSet(), skinParam.getThemeStyle()));
Colors specBack = null;
if (skinParam instanceof SkinParamColors) {
specBack = ((SkinParamColors) skinParam).getColors();
}
style = style.eventuallyOverride(specBack);
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
fc = style.getFontConfiguration(getIHtmlColorSet());
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
fc = style.getFontConfiguration(skinParam.getThemeStyle(), getIHtmlColorSet());
horizontalAlignment = style.getHorizontalAlignment();
this.padding1 = style.getPadding().getLeft();
this.padding2 = style.getPadding().getRight();

View File

@ -83,8 +83,8 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
public FtileDiamondInside(ISkinParam skinParam, HColor backColor, HColor borderColor, Swimlane swimlane,
TextBlock label) {
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0),
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
this(skinParam, backColor, borderColor, swimlane, label, TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0),
TextBlockUtils.empty(0, 0), TextBlockUtils.empty(0, 0));
}
public FtileDiamondInside withNorth(TextBlock north) {
@ -112,8 +112,8 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
super(skinParam);
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinition().getMergedStyle(skinParam.getCurrentStyleBuilder());
this.borderColor = style.value(PName.LineColor).asColor(getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(getIHtmlColorSet());
this.borderColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.backColor = style.value(PName.BackGroundColor).asColor(skinParam.getThemeStyle(), getIHtmlColorSet());
this.shadowing = style.value(PName.Shadowing).asDouble();
} else {
this.backColor = backColor;
@ -185,7 +185,8 @@ public class FtileDiamondInside extends AbstractFtile implements Styleable {
final Dimension2D dimEast = east.calculateDimension(stringBounder);
final double northHeight = north.calculateDimension(stringBounder).getHeight();
return dimDiamonAlone.incHeight(northHeight);
// return dimDiamonAlone.incHeight(northHeight).addMarginX(dimWest.getWidth(), dimEast.getWidth());
// return dimDiamonAlone.incHeight(northHeight).addMarginX(dimWest.getWidth(),
// dimEast.getWidth());
}
public double getEastLabelWidth(StringBounder stringBounder) {

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.braille;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.graphic.UDrawable;
import net.sourceforge.plantuml.ugraphic.UEllipse;
import net.sourceforge.plantuml.ugraphic.UGraphic;
@ -54,14 +55,14 @@ public class BrailleDrawer implements UDrawable {
}
public void drawU(UGraphic ug) {
ug = ug.apply(HColorSet.instance().getColorOrWhite("#F0F0F0"));
ug = ug.apply(HColorSet.instance().getColorOrWhite(ThemeStyle.LIGHT, "#F0F0F0"));
for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {
ug.apply(UTranslate.dx(x * step + spotSize + 1)).draw(
ULine.vline((grid.getMaxY() - grid.getMinY()) * step));
ug.apply(UTranslate.dx(x * step + spotSize + 1))
.draw(ULine.vline((grid.getMaxY() - grid.getMinY()) * step));
}
for (int y = grid.getMinY(); y <= grid.getMaxY(); y++) {
ug.apply(UTranslate.dy(y * step + spotSize + 1)).draw(
ULine.hline((grid.getMaxX() - grid.getMinX()) * step));
ug.apply(UTranslate.dy(y * step + spotSize + 1))
.draw(ULine.hline((grid.getMaxX() - grid.getMinX()) * step));
}
ug = ug.apply(HColorUtils.BLACK).apply(HColorUtils.BLACK.bg());
for (int x = grid.getMinX(); x <= grid.getMaxX(); x++) {

View File

@ -53,6 +53,7 @@ import net.sourceforge.plantuml.ugraphic.UPolygon;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UText;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
import static net.sourceforge.plantuml.ugraphic.ImageBuilder.plainPngBuilder;
@ -67,8 +68,8 @@ public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements Cl
return new UGraphicBraille(this);
}
public UGraphicBraille(ColorMapper colorMapper) {
this(colorMapper, new BrailleGrid(QUANTA));
public UGraphicBraille(HColor defaultBackground, ColorMapper colorMapper) {
this(defaultBackground, colorMapper, new BrailleGrid(QUANTA));
}
private UGraphicBraille(UGraphicBraille other) {
@ -97,8 +98,8 @@ public class UGraphicBraille extends AbstractUGraphic<BrailleGrid> implements Cl
// svg.paintBackcolorGradient(mapper, gr);
// }
private UGraphicBraille(ColorMapper colorMapper, BrailleGrid grid) {
super(colorMapper, grid);
private UGraphicBraille(HColor defaultBackground, ColorMapper colorMapper, BrailleGrid grid) {
super(defaultBackground, colorMapper, grid);
this.grid = grid;
register();
}

View File

@ -124,7 +124,8 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0)));
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0),
"\"([:");
@ -172,10 +173,12 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
}
entity.setCodeLine(location);
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}

View File

@ -276,10 +276,12 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
result.addUrl(url);
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}

View File

@ -152,7 +152,8 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
if (mode == Mode.NORMAL_KEYWORD && diagram.isAllowMixing() == false) {
return CommandExecutionResult.error("Use 'allowmixing' if you want to mix classes and other UML elements.");
}
@ -224,8 +225,8 @@ public class CommandCreateElementFull2 extends SingleLineCommand2<ClassDiagram>
}
final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
return CommandExecutionResult.ok();
}

View File

@ -227,8 +227,9 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
link = link.getInv();
}
link.setLinkArrow(labels.getLinkArrow());
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
link.setColors(color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet()));
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
link.setCodeLine(location);
addLink(diagram, link, arg.get("HEADER", 0));
@ -332,7 +333,8 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
}
}
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg) throws NoSuchColorException {
private CommandExecutionResult executePackageLink(AbstractClassOrObjectDiagram diagram, RegexResult arg)
throws NoSuchColorException {
final String ent1String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT1", 0), "\"");
final String ent2String = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("ENT2", 0), "\"");
final IEntity cl1 = diagram.V1972() ? diagram.getGroupVerySmart(diagram.buildLeafIdent(ent1String))
@ -354,11 +356,12 @@ final public class CommandLinkClass extends SingleLineCommand2<AbstractClassOrOb
final String secondLabel = arg.get("SECOND_LABEL", 0);
final Link link = new Link(cl1, cl2, linkType, labelLink, queue, firstLabel, secondLabel,
diagram.getLabeldistance(), diagram.getLabelangle(), diagram.getSkinParam().getCurrentStyleBuilder());
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
link.setColors(color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet()));
diagram.resetPragmaLabel();
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
addLink(diagram, link, arg.get("HEADER", 0));
return CommandExecutionResult.ok();

View File

@ -33,37 +33,36 @@
*
*
*/
package net.sourceforge.plantuml.project.command;
package net.sourceforge.plantuml.command;
import net.sourceforge.plantuml.LineLocation;
import net.sourceforge.plantuml.command.CommandExecutionResult;
import net.sourceforge.plantuml.command.SingleLineCommand2;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.TitledDiagram;
import net.sourceforge.plantuml.command.regex.IRegex;
import net.sourceforge.plantuml.command.regex.RegexConcat;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.project.GanttDiagram;
public class CommandLabelOnFirstColumn extends SingleLineCommand2<GanttDiagram> {
public class CommandAssumeTransparent extends SingleLineCommand2<TitledDiagram> {
public CommandLabelOnFirstColumn() {
public CommandAssumeTransparent() {
super(getRegexConcat());
}
static IRegex getRegexConcat() {
return RegexConcat.build(CommandLabelOnFirstColumn.class.getName(), RegexLeaf.start(), //
new RegexLeaf("labels?"), //
return RegexConcat.build(CommandAssumeTransparent.class.getName(), RegexLeaf.start(), //
new RegexLeaf("!assume"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("on"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("first"), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("column"), RegexLeaf.end()); //
new RegexLeaf("transparent"), //
RegexLeaf.spaceOneOrMore(), //
new RegexLeaf("TYPE", "(dark|light)"), //
RegexLeaf.end()); //
}
@Override
protected CommandExecutionResult executeArg(GanttDiagram diagram, LineLocation location, RegexResult arg) {
diagram.labelOnFirstColumn();
protected CommandExecutionResult executeArg(TitledDiagram system, LineLocation location, RegexResult arg) {
final String type = arg.get("TYPE", 0).toUpperCase();
system.getSkinParam().assumeTransparent(ThemeStyle.valueOf(type));
return CommandExecutionResult.ok();
}

View File

@ -78,7 +78,8 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Code code;
final IGroup currentPackage;
@ -110,7 +111,7 @@ public class CommandNamespace extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), color));
}
return CommandExecutionResult.ok();
}

View File

@ -86,7 +86,8 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
@ -110,7 +111,7 @@ public class CommandNamespace2 extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), color));
}
return CommandExecutionResult.ok();
}

View File

@ -81,7 +81,8 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort = arg.get("NAME", 0);
final Ident idNewLong = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? idNewLong : diagram.buildCode(idShort);
@ -104,7 +105,7 @@ public class CommandNamespaceEmpty extends SingleLineCommand2<ClassDiagram> {
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), color));
}
diagram.endGroup();
return CommandExecutionResult.ok();

View File

@ -102,7 +102,8 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
}
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort;
/* final */String display;
final String name = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("NAME", 0));
@ -154,7 +155,8 @@ public class CommandPackage extends SingleLineCommand2<AbstractEntityDiagram> {
p.addUrl(url);
}
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors);
return CommandExecutionResult.ok();

View File

@ -82,7 +82,8 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
}
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String idShort;
final String display;
if (arg.get("CODE", 0) == null) {
@ -106,7 +107,7 @@ public class CommandPackageEmpty extends SingleLineCommand2<AbstractEntityDiagra
final String color = arg.get("COLOR", 0);
if (color != null) {
p.setSpecificColorTOBEREMOVED(ColorType.BACK,
diagram.getSkinParam().getIHtmlColorSet().getColor(color));
diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), color));
}
diagram.endGroup();
return CommandExecutionResult.ok();

View File

@ -225,6 +225,7 @@ public abstract class PSystemCommandFactory extends PSystemAbstractFactory {
final protected void addCommonCommands2(List<Command> cmds) {
cmds.add(new CommandNope());
cmds.add(new CommandPragma());
cmds.add(new CommandAssumeTransparent());
cmds.add(new CommandSkinParam());
cmds.add(new CommandSkinParamMultilines());

View File

@ -116,7 +116,8 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
return "(?i)^[%s]*end[%s]?note$";
}
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines)
throws NoSuchColorException {
// StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
@ -126,7 +127,8 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
};
}
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display) throws NoSuchColorException {
private CommandExecutionResult executeInternal(AbstractEntityDiagram diagram, RegexResult arg, BlocLines display)
throws NoSuchColorException {
final String idShort = arg.get("CODE", 0);
final Ident ident = diagram.buildLeafIdent(idShort);
final Code code = diagram.V1972() ? ident : diagram.buildCode(idShort);
@ -137,8 +139,8 @@ public final class CommandFactoryNote implements SingleMultiFactoryCommand<Abstr
final IEntity entity = diagram.createLeaf(ident, code, display.toDisplay(), LeafType.NOTE, null);
assert entity != null;
final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
CommandCreateClassMultilines.addTags(entity, arg.get("TAGS", 0));
return CommandExecutionResult.ok();
}

View File

@ -99,7 +99,8 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
return "(?i)^[%s]*end[%s]?note$";
}
public final CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines) throws NoSuchColorException {
public final CommandExecutionResult executeNow(final ActivityDiagram diagram, BlocLines lines)
throws NoSuchColorException {
// StringUtils.trim(lines, true);
final RegexResult arg = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
@ -146,11 +147,12 @@ public final class CommandFactoryNoteActivity implements SingleMultiFactoryComma
};
}
private CommandExecutionResult executeInternal(ActivityDiagram diagram, RegexResult arg, IEntity note) throws NoSuchColorException {
private CommandExecutionResult executeInternal(ActivityDiagram diagram, RegexResult arg, IEntity note)
throws NoSuchColorException {
final String s = arg.get("COLOR", 0);
note.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
note.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
IEntity activity = diagram.getLastEntityConsulted();
if (activity == null) {

View File

@ -185,7 +185,8 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
return "(?i)^[%s]*(end[%s]?note)$";
}
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final AbstractEntityDiagram system, BlocLines lines)
throws NoSuchColorException {
// StringUtils.trim(lines, false);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
@ -236,7 +237,8 @@ public final class CommandFactoryNoteOnEntity implements SingleMultiFactoryComma
else
note = diagram.createLeaf(idNewLong, diagram.buildCode(tmp), strings.toDisplay(), LeafType.NOTE, null);
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {

View File

@ -102,7 +102,8 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
return "(?i)^end[%s]?note$";
}
protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final CucaDiagram system, BlocLines lines)
throws NoSuchColorException {
final String line0 = lines.getFirst().getTrimmed().getString();
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
@ -120,14 +121,16 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
return new SingleLineCommand2<CucaDiagram>(getRegexConcatSingleLine()) {
@Override
protected CommandExecutionResult executeArg(final CucaDiagram system, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(final CucaDiagram system, LineLocation location,
RegexResult arg) throws NoSuchColorException {
final BlocLines note = BlocLines.getWithNewlines(arg.get("NOTE", 0));
return executeInternal(system, note, arg);
}
};
}
private CommandExecutionResult executeInternal(CucaDiagram diagram, BlocLines note, final RegexResult arg) throws NoSuchColorException {
private CommandExecutionResult executeInternal(CucaDiagram diagram, BlocLines note, final RegexResult arg)
throws NoSuchColorException {
final Link link = diagram.getLastLink();
if (link == null) {
return CommandExecutionResult.error("No link defined");
@ -141,7 +144,8 @@ public final class CommandFactoryNoteOnLink implements SingleMultiFactoryCommand
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);
url = urlBuilder.getUrl(arg.get("URL", 0));
}
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
link.addNote(note.toDisplay(), position, colors);
return CommandExecutionResult.ok();
}

View File

@ -78,7 +78,7 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), RegexLeaf.end() //
);
);
}
private IRegex getRegexConcatSingleLine() {
@ -127,7 +127,8 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
return "(?i)^end[%s]?(note|hnote|rnote)$";
}
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines)
throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
@ -137,7 +138,8 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
};
}
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines)
throws NoSuchColorException {
// final Participant p1 = diagram.getOrCreateParticipant(StringUtils
// .eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
// final Participant p2 = diagram.getOrCreateParticipant(StringUtils
@ -151,8 +153,10 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
final Display display = diagram.manageVariable(lines.toDisplay());
final Note note = new Note((Participant) null, (Participant) null, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final Note note = new Note((Participant) null, (Participant) null, display,
diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
@ -162,7 +166,8 @@ public final class FactorySequenceNoteAcrossCommand implements SingleMultiFactor
}
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0)));
note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);

View File

@ -120,7 +120,8 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
return "(?i)^end[%s]?(note|hnote|rnote)$";
}
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines)
throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
@ -141,9 +142,10 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
};
}
private CommandExecutionResult executeInternal(SequenceDiagram diagram, RegexResult arg, BlocLines strings) throws NoSuchColorException {
final Participant p = diagram.getOrCreateParticipant(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0)));
private CommandExecutionResult executeInternal(SequenceDiagram diagram, RegexResult arg, BlocLines strings)
throws NoSuchColorException {
final Participant p = diagram.getOrCreateParticipant(
StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get("PARTICIPANT", 0)));
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(arg.get("POSITION", 0)));
@ -152,7 +154,8 @@ public final class FactorySequenceNoteCommand implements SingleMultiFactoryComma
final boolean parallel = arg.get("PARALLEL", 0) != null;
final Display display = diagram.manageVariable(strings.toDisplay());
final Note note = new Note(p, position, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = arg.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);

View File

@ -123,7 +123,8 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
return "(?i)^[%s]*end[%s]?note$";
}
protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final SequenceDiagram diagram, BlocLines lines)
throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
@ -133,7 +134,8 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
};
}
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines)
throws NoSuchColorException {
final EventWithDeactivate m = diagram.getLastEventWithDeactivate();
if (m instanceof AbstractMessage || m instanceof GroupingLeaf) {
final NotePosition position = NotePosition.valueOf(StringUtils.goUpperCase(line0.get("POSITION", 0)));
@ -146,8 +148,8 @@ public final class FactorySequenceNoteOnArrowCommand implements SingleMultiFacto
final NoteStyle style = NoteStyle.getNoteStyle(line0.get("STYLE", 0));
final Display display = diagram.manageVariable(lines.toDisplay());
final String backcolor0 = line0.get("COLOR", 0);
Colors colors = Colors.empty().add(ColorType.BACK,
backcolor0 == null ? null : HColorSet.instance().getColor(backcolor0));
Colors colors = Colors.empty().add(ColorType.BACK, backcolor0 == null ? null
: HColorSet.instance().getColor(diagram.getSkinParam().getThemeStyle(), backcolor0));
final Note note = new Note(display, position, style, diagram.getSkinParam().getCurrentStyleBuilder());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {

View File

@ -86,7 +86,7 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
color().getRegex(), //
RegexLeaf.spaceZeroOrMore(), //
new RegexLeaf("URL", "(" + UrlBuilder.getRegexp() + ")?"), RegexLeaf.end() //
);
);
}
private IRegex getRegexConcatSingleLine() {
@ -142,7 +142,8 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
return "(?i)^end[%s]?(note|hnote|rnote)$";
}
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(final SequenceDiagram system, BlocLines lines)
throws NoSuchColorException {
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
lines = lines.subExtract(1, 1);
lines = lines.removeEmptyColumns();
@ -152,18 +153,20 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
};
}
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines) throws NoSuchColorException {
final Participant p1 = diagram.getOrCreateParticipant(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
final Participant p2 = diagram.getOrCreateParticipant(StringUtils
.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P2", 0)));
private CommandExecutionResult executeInternal(SequenceDiagram diagram, final RegexResult line0, BlocLines lines)
throws NoSuchColorException {
final Participant p1 = diagram
.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P1", 0)));
final Participant p2 = diagram
.getOrCreateParticipant(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(line0.get("P2", 0)));
if (lines.size() > 0) {
final boolean tryMerge = line0.get("VMERGE", 0) != null;
final boolean parallel = line0.get("PARALLEL", 0) != null;
final Display display = diagram.manageVariable(lines.toDisplay());
final Note note = new Note(p1, p2, display, diagram.getSkinParam().getCurrentStyleBuilder());
Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
final String stereotypeString = line0.get("STEREO", 0);
if (stereotypeString != null) {
final Stereotype stereotype = new Stereotype(stereotypeString);
@ -173,7 +176,8 @@ public final class FactorySequenceNoteOverSeveralCommand implements SingleMultiF
}
note.setColors(colors);
// note.setSpecificColorTOBEREMOVED(ColorType.BACK,
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR", 0)));
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0)));
note.setNoteStyle(NoteStyle.getNoteStyle(line0.get("STYLE", 0)));
if (line0.get("URL", 0) != null) {
final UrlBuilder urlBuilder = new UrlBuilder(diagram.getSkinParam().getValue("topurl"), ModeUrl.STRICT);

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -48,20 +49,21 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorAndSizeChange implements Command {
private final Pattern2 pattern;
private final ThemeStyle themeStyle;
public static final String fontPattern = "\\<font(?:[%s]+size[%s]*=[%s]*[%g]?(\\d+)[%g]?|[%s]+color[%s]*=[%s]*[%g]?(#[0-9a-fA-F]{6}|\\w+)[%g]?)+[%s]*\\>";
public static Command create() {
return new CommandCreoleColorAndSizeChange("^(?i)(" + fontPattern + "(.*?)\\</font\\>)");
public static Command create(ThemeStyle themeStyle) {
return new CommandCreoleColorAndSizeChange(themeStyle, "^(?i)(" + fontPattern + "(.*?)\\</font\\>)");
}
public static Command createEol() {
return new CommandCreoleColorAndSizeChange("^(?i)(" + fontPattern + "(.*))$");
public static Command createEol(ThemeStyle themeStyle) {
return new CommandCreoleColorAndSizeChange(themeStyle, "^(?i)(" + fontPattern + "(.*))$");
}
private CommandCreoleColorAndSizeChange(String p) {
private CommandCreoleColorAndSizeChange(ThemeStyle themeStyle, String p) {
this.pattern = MyPattern.cmpile(p);
this.themeStyle = themeStyle;
}
public int matchingSize(String line) {
@ -89,7 +91,7 @@ public class CommandCreoleColorAndSizeChange implements Command {
try {
if (m.group(3) != null) {
final String s = m.group(3);
final HColor color = HColorSet.instance().getColor(s);
final HColor color = HColorSet.instance().getColor(themeStyle, s);
fc2 = fc2.changeColor(color);
}

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -49,17 +50,19 @@ import net.sourceforge.plantuml.ugraphic.color.NoSuchColorRuntimeException;
public class CommandCreoleColorChange implements Command {
private final Pattern2 pattern;
private final ThemeStyle themeStyle;
public static Command create() {
return new CommandCreoleColorChange("^(?i)(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
public static Command create(ThemeStyle themeStyle) {
return new CommandCreoleColorChange(themeStyle, "^(?i)(" + Splitter.fontColorPattern2 + "(.*?)\\</color\\>)");
}
public static Command createEol() {
return new CommandCreoleColorChange("^(?i)(" + Splitter.fontColorPattern2 + "(.*)$)");
public static Command createEol(ThemeStyle themeStyle) {
return new CommandCreoleColorChange(themeStyle, "^(?i)(" + Splitter.fontColorPattern2 + "(.*)$)");
}
private CommandCreoleColorChange(String p) {
private CommandCreoleColorChange(ThemeStyle themeStyle, String p) {
this.pattern = MyPattern.cmpile(p);
this.themeStyle = themeStyle;
}
@ -79,7 +82,7 @@ public class CommandCreoleColorChange implements Command {
final FontConfiguration fc1 = stripe.getActualFontConfiguration();
final String s = m.group(2);
try {
final HColor color = HColorSet.instance().getColor(s);
final HColor color = HColorSet.instance().getColor(themeStyle, s);
final FontConfiguration fc2 = fc1.changeColor(color);
stripe.setActualFontConfiguration(fc2);
stripe.analyzeAndAdd(m.group(3));

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -48,14 +49,16 @@ public class CommandCreoleOpenIcon implements Command {
private final Pattern2 pattern;
private final HColorSet colorSet;
private final ThemeStyle themeStyle;
private CommandCreoleOpenIcon(HColorSet colorSet, String p) {
private CommandCreoleOpenIcon(ThemeStyle themeStyle, HColorSet colorSet, String p) {
this.pattern = MyPattern.cmpile(p);
this.colorSet = colorSet;
this.themeStyle = themeStyle;
}
public static Command create(HColorSet colorSet) {
return new CommandCreoleOpenIcon(colorSet, "^(?i)(" + Splitter.openiconPattern + ")");
public static Command create(ThemeStyle themeStyle, HColorSet colorSet) {
return new CommandCreoleOpenIcon(themeStyle, colorSet, "^(?i)(" + Splitter.openiconPattern + ")");
}
public int matchingSize(String line) {
@ -76,7 +79,7 @@ public class CommandCreoleOpenIcon implements Command {
final String colorName = Parser.getColor(m.group(3));
HColor color = null;
if (colorName != null) {
color = colorSet.getColorOrWhite(colorName);
color = colorSet.getColorOrWhite(themeStyle, colorName);
}
stripe.addOpenIcon(src, scale, color);
return line.substring(m.group(1).length());

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.creole.command;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -48,14 +49,16 @@ public class CommandCreoleSprite implements Command {
private final Pattern2 pattern;
private final HColorSet colorSet;
private final ThemeStyle themeStyle;
private CommandCreoleSprite(HColorSet colorSet, String p) {
private CommandCreoleSprite(ThemeStyle themeStyle, HColorSet colorSet, String p) {
this.pattern = MyPattern.cmpile(p);
this.colorSet = colorSet;
this.themeStyle = themeStyle;
}
public static Command create(HColorSet colorSet) {
return new CommandCreoleSprite(colorSet, "^(?i)(" + Splitter.spritePattern2 + ")");
public static Command create(ThemeStyle themeStyle, HColorSet colorSet) {
return new CommandCreoleSprite(themeStyle, colorSet, "^(?i)(" + Splitter.spritePattern2 + ")");
}
public int matchingSize(String line) {
@ -76,7 +79,7 @@ public class CommandCreoleSprite implements Command {
final String colorName = Parser.getColor(m.group(3));
HColor color = null;
if (colorName != null) {
color = colorSet.getColorOrWhite(colorName);
color = colorSet.getColorOrWhite(themeStyle, colorName);
}
stripe.addSprite(src, scale, color);
return line.substring(m.group(1).length());

View File

@ -150,7 +150,10 @@ public final class AtomText extends AbstractAtom implements Atom {
useFontConfiguration = fontConfiguration.changeColor(textColor);
}
if (textColor instanceof HColorAutomatic) {
final HColor backcolor = ug.getParam().getBackcolor();
HColor backcolor = ug.getParam().getBackcolor();
if (backcolor == null) {
backcolor = ug.getDefaultBackground();
}
textColor = ((HColorAutomatic) textColor).getAppropriateColor(backcolor);
useFontConfiguration = fontConfiguration.changeColor(textColor);
}

View File

@ -153,18 +153,18 @@ public class StripeSimple implements Stripe {
this.commands.add(CommandCreoleStyle.createLegacyEol(FontStyle.BACKCOLOR));
this.commands.add(CommandCreoleSizeChange.create());
this.commands.add(CommandCreoleSizeChange.createEol());
this.commands.add(CommandCreoleColorChange.create());
this.commands.add(CommandCreoleColorChange.createEol());
this.commands.add(CommandCreoleColorAndSizeChange.create());
this.commands.add(CommandCreoleColorAndSizeChange.createEol());
this.commands.add(CommandCreoleColorChange.create(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleColorChange.createEol(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleColorAndSizeChange.create(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleColorAndSizeChange.createEol(skinParam.getThemeStyle()));
this.commands.add(CommandCreoleExposantChange.create(FontPosition.EXPOSANT));
this.commands.add(CommandCreoleExposantChange.create(FontPosition.INDICE));
this.commands.add(CommandCreoleImg.create());
this.commands.add(CommandCreoleQrcode.create());
this.commands.add(CommandCreoleOpenIcon.create(skinParam.getIHtmlColorSet()));
this.commands.add(CommandCreoleOpenIcon.create(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
this.commands.add(CommandCreoleMath.create());
this.commands.add(CommandCreoleLatex.create());
this.commands.add(CommandCreoleSprite.create(skinParam.getIHtmlColorSet()));
this.commands.add(CommandCreoleSprite.create(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
this.commands.add(CommandCreoleSpace.create());
this.commands.add(CommandCreoleFontFamilyChange.create());
this.commands.add(CommandCreoleFontFamilyChange.createEol());

View File

@ -107,7 +107,7 @@ public class StripeTable implements Stripe {
final String[] color = line.substring(idx1, idx2).split(",");
if (idx < color.length) {
final String s = color[idx];
return s == null ? null : skinParam.getIHtmlColorSet().getColorOrWhite(s);
return s == null ? null : skinParam.getIHtmlColorSet().getColorOrWhite(skinParam.getThemeStyle(), s);
}
}
return null;

View File

@ -92,7 +92,7 @@ public class BodyEnhanced1 extends BodyEnhancedAbstract implements TextBlock, Wi
BodyEnhanced1(HorizontalAlignment align, Display display, FontParam fontParam, ISkinParam skinParam,
Stereotype stereotype, ILeaf entity, Style style) {
super(align, style == null ? new FontConfiguration(skinParam, fontParam, stereotype)
: style.getFontConfiguration(skinParam.getIHtmlColorSet()));
: style.getFontConfiguration(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()));
this.style = style;
this.entity = entity;

View File

@ -154,7 +154,7 @@ public class Stereotype implements CharSequence {
local = null;
}
final String colName = mCircleSprite.get("COLOR", 0);
final HColor col = colName == null ? null : htmlColorSet.getColor(colName);
final HColor col = colName == null ? null : htmlColorSet.getColorLEGACY(colName);
this.htmlColor = col == null ? HColorUtils.BLACK : col;
this.spriteName = mCircleSprite.get("NAME", 0);
this.character = '\0';
@ -166,7 +166,7 @@ public class Stereotype implements CharSequence {
local = null;
}
final String colName = mCircleChar.get("COLOR", 0);
this.htmlColor = colName == null ? null : htmlColorSet.getColor(colName);
this.htmlColor = colName == null ? null : htmlColorSet.getColorLEGACY(colName);
this.character = mCircleChar.get("CHAR", 0).charAt(0);
this.spriteName = null;
}

View File

@ -40,6 +40,7 @@ import java.util.Collections;
import java.util.List;
import java.util.StringTokenizer;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.graphic.color.ColorType;
import net.sourceforge.plantuml.graphic.color.Colors;
import net.sourceforge.plantuml.ugraphic.color.HColor;
@ -113,7 +114,7 @@ public abstract class WithLinkType {
return single;
}
public void applyStyle(String arrowStyle) {
public void applyStyle(ThemeStyle themeStyle, String arrowStyle) {
if (arrowStyle == null) {
return;
}
@ -121,12 +122,12 @@ public abstract class WithLinkType {
int i = 0;
while (st.hasMoreTokens()) {
final String s = st.nextToken();
applyOneStyle(s, i);
applyOneStyle(themeStyle, s, i);
i++;
}
}
private void applyOneStyle(String arrowStyle, int i) {
private void applyOneStyle(ThemeStyle themeStyle, String arrowStyle, int i) {
final StringTokenizer st = new StringTokenizer(arrowStyle, ",");
while (st.hasMoreTokens()) {
final String s = st.nextToken();
@ -147,7 +148,7 @@ public abstract class WithLinkType {
} else if (s.startsWith("thickness=")) {
this.goThickness(Double.parseDouble(s.substring("thickness=".length())));
} else {
final HColor tmp = HColorSet.instance().getColorOrWhite(s);
final HColor tmp = HColorSet.instance().getColorOrWhite(themeStyle, s);
setSpecificColor(tmp, i);
}
}

View File

@ -84,7 +84,8 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
}
@Override
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
String type = arg.get("TYPE", 0);
String display = arg.getLazzy("DISPLAY", 0);
String codeString = arg.getLazzy("CODE", 0);
@ -130,8 +131,8 @@ public class CommandCreateDomain extends SingleLineCommand2<DescriptionDiagram>
entity.addUrl(url);
}
final String s = arg.get("COLOR", 0);
entity.setSpecificColorTOBEREMOVED(ColorType.BACK,
s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s));
entity.setSpecificColorTOBEREMOVED(ColorType.BACK, s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s));
if (type.equalsIgnoreCase("domain")) {
if (stereotype != null && stereotype.equalsIgnoreCase("<<Machine>>")) {
type = "machine";

View File

@ -120,7 +120,8 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
}
@Override
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String codeRaw = arg.getLazzy("CODE", 0);
final String idShort = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw);
@ -141,12 +142,14 @@ public class CommandArchimate extends SingleLineCommand2<DescriptionDiagram> {
entity.setDisplay(Display.getWithNewlines(display));
entity.setUSymbol(USymbol.ARCHIMATE);
if (icon != null) {
entity.setStereotype(new Stereotype("<<$archimate/" + icon + ">>", diagram.getSkinParam()
.getCircledCharacterRadius(), diagram.getSkinParam().getFont(null, false,
FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getIHtmlColorSet()));
entity.setStereotype(
new Stereotype("<<$archimate/" + icon + ">>", diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet()));
}
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
entity.setColors(colors);
return CommandExecutionResult.ok();

View File

@ -99,7 +99,8 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
}
@Override
protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocLines lines)
throws NoSuchColorException {
lines = lines.trim();
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final String codeRaw = line0.getLazzy("CODE", 0);
@ -117,12 +118,14 @@ public class CommandArchimateMultilines extends CommandMultilines2<AbstractEntit
entity.setDisplay(display);
entity.setUSymbol(USymbol.RECTANGLE);
if (icon != null) {
entity.setStereotype(new Stereotype("<<$archimate/" + icon + ">>", diagram.getSkinParam()
.getCircledCharacterRadius(), diagram.getSkinParam().getFont(null, false,
FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getIHtmlColorSet()));
entity.setStereotype(
new Stereotype("<<$archimate/" + icon + ">>", diagram.getSkinParam().getCircledCharacterRadius(),
diagram.getSkinParam().getFont(null, false, FontParam.CIRCLED_CHARACTER),
diagram.getSkinParam().getIHtmlColorSet()));
}
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
entity.setColors(colors);
return CommandExecutionResult.ok();

View File

@ -155,7 +155,8 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
}
@Override
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(DescriptionDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
String codeRaw = arg.getLazzy("CODE", 0);
String displayRaw = arg.getLazzy("DISPLAY", 0);
final char codeChar = getCharEncoding(codeRaw);
@ -261,10 +262,12 @@ public class CommandCreateElementFull extends SingleLineCommand2<DescriptionDiag
entity.addUrl(url);
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}

View File

@ -124,7 +124,8 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
}
@Override
protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocLines lines) throws NoSuchColorException {
protected CommandExecutionResult executeNow(AbstractEntityDiagram diagram, BlocLines lines)
throws NoSuchColorException {
lines = lines.trimSmart(1);
final RegexResult line0 = getStartingPattern().matcher(lines.getFirst().getTrimmed().getString());
final String symbol = StringUtils.goUpperCase(line0.get("TYPE", 0));
@ -185,7 +186,8 @@ public class CommandCreateElementMultilines extends CommandMultilines2<AbstractE
// final HColor backColor =
// diagram.getSkinParam().getIHtmlColorSet().getColorIfValid(line0.get("COLOR",
// 0));
final Colors colors = color().getColor(line0, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), line0,
diagram.getSkinParam().getIHtmlColorSet());
result.setColors(colors);
// result.setSpecificColorTOBEREMOVED(ColorType.BACK, backColor);

View File

@ -148,7 +148,8 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
}
@Override
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(ClassDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
String codeRaw = arg.getLazzy("CODE", 0);
final String displayRaw = arg.getLazzy("DISPLAY", 0);
final String symbol = "interface";
@ -192,10 +193,12 @@ public class CommandCreateElementParenthesis extends SingleLineCommand2<ClassDia
entity.addUrl(url);
}
Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
final String s = arg.get("LINECOLOR", 1);
final HColor lineColor = s == null ? null : diagram.getSkinParam().getIHtmlColorSet().getColor(s);
final HColor lineColor = s == null ? null
: diagram.getSkinParam().getIHtmlColorSet().getColor(diagram.getSkinParam().getThemeStyle(), s);
if (lineColor != null) {
colors = colors.add(ColorType.LINE, lineColor);
}

View File

@ -269,8 +269,9 @@ public class CommandLinkElement extends SingleLineCommand2<DescriptionDiagram> {
if (dir == Direction.LEFT || dir == Direction.UP) {
link = link.getInv();
}
link.setColors(color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()));
link.applyStyle(arg.getLazzy("ARROW_STYLE", 0));
link.setColors(color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet()));
link.applyStyle(diagram.getSkinParam().getThemeStyle(), arg.getLazzy("ARROW_STYLE", 0));
if (arg.get("STEREOTYPE", 0) != null) {
final Stereotype stereotype = new Stereotype(arg.get("STEREOTYPE", 0));
if (UseStyle.useBetaStyle()) {

View File

@ -134,7 +134,8 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
}
@Override
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg) throws NoSuchColorException {
protected CommandExecutionResult executeArg(AbstractEntityDiagram diagram, LineLocation location, RegexResult arg)
throws NoSuchColorException {
final String codeRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("CODE", 0));
final String displayRaw = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.getLazzy("DISPLAY", 0));
final String display;
@ -174,7 +175,8 @@ public class CommandPackageWithUSymbol extends SingleLineCommand2<AbstractEntity
p.addUrl(url);
}
CommandCreateClassMultilines.addTags(p, arg.get("TAGS", 0));
final Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet());
final Colors colors = color().getColor(diagram.getSkinParam().getThemeStyle(), arg,
diagram.getSkinParam().getIHtmlColorSet());
p.setColors(colors);
return CommandExecutionResult.ok();
}

View File

@ -72,7 +72,7 @@ public class GraphicsPath {
final BufferedImage im = builder.getBufferedImage();
final Graphics2D g2d = builder.getGraphics2D();
final UGraphicG2d ug = new UGraphicG2d(colorMapper, g2d, 1.0);
final UGraphicG2d ug = new UGraphicG2d(HColorUtils.WHITE, colorMapper, g2d, 1.0);
ug.setBufferedImage(im);
final UMotif motif = new UMotif(path);
motif.drawHorizontal(ug.apply((UChange) HColorUtils.BLACK), 20, 20, 1);

View File

@ -84,7 +84,7 @@ public class SmetanaForGit {
public SmetanaForGit(UGraphic ug, ISkinParam skinParam) {
this.stringBounder = ug.getStringBounder();
this.skinParam = skinParam;
this.ug = getStyle().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
this.ug = getStyle().applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(), skinParam.getThemeStyle());
}
private Style getStyle() {

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -50,11 +51,11 @@ class ColorAndSizeChange implements FontChange {
private final HColor color;
private final Integer size;
ColorAndSizeChange(String s) {
ColorAndSizeChange(ThemeStyle themeStyle, String s) {
final Matcher2 matcherColor = colorPattern.matcher(s);
if (matcherColor.find()) {
final String s1 = matcherColor.group(1);
color = HColorSet.instance().getColorOrWhite(s1);
color = HColorSet.instance().getColorOrWhite(themeStyle, s1);
} else {
color = null;
}

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -47,13 +48,13 @@ class ColorChange implements FontChange {
private final HColor color;
ColorChange(String s) {
ColorChange(ThemeStyle themeStyle, String s) {
final Matcher2 matcherColor = colorPattern.matcher(s);
if (matcherColor.find() == false) {
throw new IllegalArgumentException();
}
final String s1 = matcherColor.group(1);
this.color = HColorSet.instance().getColorOrWhite(s1);
this.color = HColorSet.instance().getColorOrWhite(themeStyle, s1);
}
HColor getColor() {

View File

@ -91,7 +91,8 @@ public class FontConfiguration {
public FontConfiguration(ISkinParam skinParam, Style style) {
// User getStyle().getFontConfiguration(skinParam.getIHtmlColorSet()) instead ?
this(style.getUFont(), style.value(PName.FontColor).asColor(skinParam.getIHtmlColorSet()),
this(style.getUFont(),
style.value(PName.FontColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet()),
skinParam.getHyperlinkColor(), skinParam.useUnderlineForHyperlink(), skinParam.getTabSize());
}

View File

@ -91,7 +91,7 @@ public class HtmlColorAndStyle {
HColor arrowHeadColor = null;
if (UseStyle.useBetaStyle()) {
final Style style = getDefaultStyleDefinitionArrow().getMergedStyle(skinParam.getCurrentStyleBuilder());
arrowColor = style.value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
arrowColor = style.value(PName.LineColor).asColor(skinParam.getThemeStyle(), skinParam.getIHtmlColorSet());
} else {
arrowColor = Rainbow.build(skinParam).getColors().get(0).arrowColor;
arrowColor = Rainbow.build(skinParam).getColors().get(0).arrowHeadColor;
@ -104,7 +104,7 @@ public class HtmlColorAndStyle {
style = tmpStyle;
continue;
}
final HColor tmpColor = s == null ? null : set.getColor(s);
final HColor tmpColor = s == null ? null : set.getColor(skinParam.getThemeStyle(), s);
if (tmpColor != null) {
arrowColor = tmpColor;
}

View File

@ -38,6 +38,7 @@ package net.sourceforge.plantuml.graphic;
import java.util.EnumSet;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.Url;
import net.sourceforge.plantuml.UrlBuilder;
import net.sourceforge.plantuml.UrlBuilder.ModeUrl;
@ -68,7 +69,7 @@ class HtmlCommandFactory {
private Pattern2 htmlTag = MyPattern.cmpile(Splitter.htmlTag, Pattern.CASE_INSENSITIVE);
HtmlCommand getHtmlCommand(String s) {
HtmlCommand getHtmlCommand(ThemeStyle themeStyle, String s) {
if (htmlTag.matcher(s).matches() == false) {
return new Text(s);
}
@ -88,11 +89,11 @@ class HtmlCommandFactory {
}
if (MyPattern.mtches(s, Splitter.fontPattern)) {
return new ColorAndSizeChange(s);
return new ColorAndSizeChange(themeStyle, s);
}
if (MyPattern.mtches(s, Splitter.fontColorPattern2)) {
return new ColorChange(s);
return new ColorChange(themeStyle, s);
}
if (MyPattern.mtches(s, Splitter.fontSizePattern2)) {

View File

@ -41,6 +41,7 @@ import java.util.List;
import net.sourceforge.plantuml.ColorParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.skin.rose.Rose;
import net.sourceforge.plantuml.style.PName;
@ -85,8 +86,8 @@ public class Rainbow {
return fromColor(arrow, arrowHead);
}
public static Rainbow build(Style style, HColorSet set) {
final HColor color = style.value(PName.LineColor).asColor(set);
public static Rainbow build(Style style, HColorSet set, ThemeStyle themeStyle) {
final HColor color = style.value(PName.LineColor).asColor(themeStyle, set);
return fromColor(color, null);
}
@ -106,7 +107,8 @@ public class Rainbow {
return result;
}
public static Rainbow build(ISkinParam skinParam, String colorString, int colorArrowSeparationSpace) throws NoSuchColorException {
public static Rainbow build(ISkinParam skinParam, String colorString, int colorArrowSeparationSpace)
throws NoSuchColorException {
if (colorString == null) {
return Rainbow.none();
}

View File

@ -76,7 +76,7 @@ class SingleLine extends AbstractTextBlock implements Line {
this.horizontalAlignment = horizontalAlignment;
final Splitter lineSplitter = new Splitter(text);
for (HtmlCommand cmd : lineSplitter.getHtmlCommands(false)) {
for (HtmlCommand cmd : lineSplitter.getHtmlCommands(spriteContainer.getThemeStyle(), false)) {
if (cmd instanceof Text) {
final String s = ((Text) cmd).getText();
blocs.add(new TileText(s, fontConfiguration, null));
@ -111,13 +111,16 @@ class SingleLine extends AbstractTextBlock implements Line {
// private double maxDeltaY(Graphics2D g2d) {
// double result = 0;
// final Dimension2D dim = calculateDimension(StringBounderUtils.asStringBounder(g2d));
// final Dimension2D dim =
// calculateDimension(StringBounderUtils.asStringBounder(g2d));
// for (TextBlock b : blocs) {
// if (b instanceof TileText == false) {
// continue;
// }
// final Dimension2D dimBloc = b.calculateDimension(StringBounderUtils.asStringBounder(g2d));
// final double deltaY = dim.getHeight() - dimBloc.getHeight() + ((TileText) b).getFontSize2D();
// final Dimension2D dimBloc =
// b.calculateDimension(StringBounderUtils.asStringBounder(g2d));
// final double deltaY = dim.getHeight() - dimBloc.getHeight() + ((TileText)
// b).getFontSize2D();
// result = Math.max(result, deltaY);
// }
// return result;

View File

@ -43,6 +43,7 @@ import java.util.List;
import java.util.regex.Pattern;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.Matcher2;
import net.sourceforge.plantuml.command.regex.MyPattern;
import net.sourceforge.plantuml.command.regex.Pattern2;
@ -145,11 +146,11 @@ public class Splitter {
return s.replaceAll(htmlTag, "");
}
public List<HtmlCommand> getHtmlCommands(boolean newLineAlone) {
public List<HtmlCommand> getHtmlCommands(ThemeStyle themeStyle, boolean newLineAlone) {
final HtmlCommandFactory factory = new HtmlCommandFactory();
final List<HtmlCommand> result = new ArrayList<HtmlCommand>();
for (String s : getSplittedInternal()) {
final HtmlCommand cmd = factory.getHtmlCommand(s);
final HtmlCommand cmd = factory.getHtmlCommand(themeStyle, s);
if (newLineAlone && cmd instanceof Text) {
result.addAll(splitText((Text) cmd));
} else {

View File

@ -41,6 +41,7 @@ import net.sourceforge.plantuml.ugraphic.UGroupType;
import net.sourceforge.plantuml.ugraphic.UParam;
import net.sourceforge.plantuml.ugraphic.UShape;
import net.sourceforge.plantuml.ugraphic.color.ColorMapper;
import net.sourceforge.plantuml.ugraphic.color.HColor;
public abstract class UGraphicDelegator implements UGraphic {
@ -99,4 +100,9 @@ public abstract class UGraphicDelegator implements UGraphic {
ug.flushUg();
}
@Override
public HColor getDefaultBackground() {
return ug.getDefaultBackground();
}
}

View File

@ -35,6 +35,7 @@
*/
package net.sourceforge.plantuml.graphic.color;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.command.regex.RegexLeaf;
import net.sourceforge.plantuml.command.regex.RegexResult;
import net.sourceforge.plantuml.ugraphic.color.HColorSet;
@ -57,7 +58,7 @@ public class ColorParser {
this.mainType = mainType;
}
public Colors getColor(RegexResult arg, HColorSet set) throws NoSuchColorException {
public Colors getColor(ThemeStyle themeStyle, RegexResult arg, HColorSet set) throws NoSuchColorException {
if (mainType == null) {
throw new IllegalStateException();
}
@ -65,8 +66,7 @@ public class ColorParser {
if (data == null) {
return Colors.empty();
}
return new Colors(data, set, mainType);
// return result.getColor(type);
return new Colors(themeStyle, data, set, mainType);
}
// New Parsers

View File

@ -44,6 +44,7 @@ import net.sourceforge.plantuml.FontParam;
import net.sourceforge.plantuml.ISkinParam;
import net.sourceforge.plantuml.SkinParamColors;
import net.sourceforge.plantuml.StringUtils;
import net.sourceforge.plantuml.ThemeStyle;
import net.sourceforge.plantuml.UseStyle;
import net.sourceforge.plantuml.cucadiagram.LinkStyle;
import net.sourceforge.plantuml.cucadiagram.Stereotype;
@ -82,7 +83,7 @@ public class Colors {
private Colors() {
}
public Colors(String data, HColorSet set, ColorType mainType) throws NoSuchColorException {
public Colors(ThemeStyle themeStyle, String data, HColorSet set, ColorType mainType) throws NoSuchColorException {
data = StringUtils.goLowerCase(data);
for (final StringTokenizer st = new StringTokenizer(data, "#;"); st.hasMoreTokens();) {
@ -90,7 +91,7 @@ public class Colors {
final int x = s.indexOf(':');
if (x == -1) {
if (s.contains(".") == false) {
map.put(mainType, set.getColor(s));
map.put(mainType, set.getColor(themeStyle, s));
}
} else {
final String name = s.substring(0, x);
@ -99,7 +100,7 @@ public class Colors {
this.shadowing = value.equalsIgnoreCase("true");
} else {
final ColorType key = ColorType.getType(name);
final HColor color = set.getColor(value);
final HColor color = set.getColor(themeStyle, value);
map.put(key, color);
}
}
@ -187,7 +188,8 @@ public class Colors {
return ug.apply(colors.lineStyle.getStroke3());
}
public Colors applyStereotype(Stereotype stereotype, ISkinParam skinParam, ColorParam param) throws NoSuchColorException {
public Colors applyStereotype(Stereotype stereotype, ISkinParam skinParam, ColorParam param)
throws NoSuchColorException {
if (stereotype == null) {
throw new IllegalArgumentException();
}

View File

@ -110,7 +110,7 @@ public class SmetanaForJson {
}
private UGraphic getUgFor(SName name) {
return getStyle(name).applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet());
return getStyle(name).applyStrokeAndLineColor(ug, skinParam.getIHtmlColorSet(), skinParam.getThemeStyle());
}
private SName getDiagramType() {
@ -173,7 +173,8 @@ public class SmetanaForJson {
for (InternalNode node : nodes) {
node.block.drawU(getUgFor(SName.node).apply(getPosition(node.node)));
}
final HColor color = getStyle(SName.arrow).value(PName.LineColor).asColor(skinParam.getIHtmlColorSet());
final HColor color = getStyle(SName.arrow).value(PName.LineColor).asColor(skinParam.getThemeStyle(),
skinParam.getIHtmlColorSet());
for (ST_Agedge_s edge : edges) {
final JsonCurve curve = getCurve(edge, 13);

Some files were not shown because too many files have changed in this diff Show More