Merge pull request #3876 from ripcurlx/fix-css-issues

Fix style issues
This commit is contained in:
sqrrm 2020-01-08 23:54:18 +01:00 committed by GitHub
commit 59021e2c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 55 additions and 43 deletions

View File

@ -25,7 +25,6 @@ import java.util.Locale;
public class GlobalSettings {
private static boolean useAnimations = true;
private static boolean useDarkMode = false;
private static Locale locale;
private static final ObjectProperty<Locale> localeProperty = new SimpleObjectProperty<>(locale);
private static TradeCurrency defaultTradeCurrency;
@ -48,10 +47,6 @@ public class GlobalSettings {
GlobalSettings.useAnimations = useAnimations;
}
public static void setUseDarkMode(boolean useDarkMode) {
GlobalSettings.useDarkMode = useDarkMode;
}
public static void setDefaultTradeCurrency(TradeCurrency fiatCurrency) {
GlobalSettings.defaultTradeCurrency = fiatCurrency;
}

View File

@ -1645,12 +1645,12 @@ textfield */
#buy-button-big {
-fx-font-size: 1em;
-fx-background-color: -bs-buy;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
}
#buy-button {
-fx-background-color: -bs-buy;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
}
#buy-button-big:hover, #buy-button:hover,
@ -1660,13 +1660,13 @@ textfield */
#sell-button-big {
-fx-background-color: -bs-sell;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
-fx-font-size: 1em;
}
#sell-button {
-fx-background-color: -bs-sell;
-fx-text-fill: white;
-fx-text-fill: -bs-white;
}
#sell-button-big:hover, #sell-button:hover,

View File

@ -156,7 +156,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
priceAsPercentageValueCurrencyBox, volumeValueCurrencyBox, priceValueCurrencyBox,
minAmountValueCurrencyBox, advancedOptionsBox, paymentGroupBox;
private Subscription isWaitingForFundsSubscription, balanceSubscription, cancelButton2StyleSubscription;
private Subscription isWaitingForFundsSubscription, balanceSubscription;
private ChangeListener<Boolean> amountFocusedListener, minAmountFocusedListener, volumeFocusedListener,
buyerSecurityDepositFocusedListener, priceFocusedListener, placeOfferCompletedListener,
priceAsPercentageFocusedListener, getShowWalletFundedNotificationListener,
@ -662,15 +662,11 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
waitingForFundsLabel.setManaged(isWaitingForFunds);
});
cancelButton2StyleSubscription = EasyBind.subscribe(placeOfferButton.visibleProperty(),
isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));
balanceSubscription = EasyBind.subscribe(model.getDataModel().getBalance(), balanceTextField::setBalance);
}
private void removeSubscriptions() {
isWaitingForFundsSubscription.unsubscribe();
cancelButton2StyleSubscription.unsubscribe();
balanceSubscription.unsubscribe();
}
@ -1294,7 +1290,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
Res.get("shared.distanceInPercent"));
percentagePriceDescription = priceAsPercentageInputBoxTuple.first;
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription);
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, percentagePriceDescription, "small-icon-label");
percentagePriceBox = priceAsPercentageInputBoxTuple.second;
@ -1367,7 +1363,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
Tuple2<Label, VBox> priceInputBoxTuple = getTradeInputBox(priceValueCurrencyBox, "");
priceDescriptionLabel = priceInputBoxTuple.first;
getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel);
getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel, "small-icon-label");
editOfferElements.add(priceDescriptionLabel);
fixedPriceBox = priceInputBoxTuple.second;

View File

@ -37,6 +37,7 @@ import bisq.desktop.main.funds.withdrawal.WithdrawalView;
import bisq.desktop.main.offer.OfferView;
import bisq.desktop.main.overlays.popups.Popup;
import bisq.desktop.main.overlays.windows.OfferDetailsWindow;
import bisq.desktop.util.CssTheme;
import bisq.desktop.util.DisplayUtils;
import bisq.desktop.util.FormBuilder;
import bisq.desktop.util.GUIUtil;
@ -1001,12 +1002,14 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
if (myOffer) {
iconView.setId("image-remove");
title = Res.get("shared.remove");
button.setId("cancel-button");
button.setId(null);
button.setStyle(CssTheme.isDarkTheme() ? "-fx-text-fill: white" : "-fx-text-fill: #444444");
button.setOnAction(e -> onRemoveOpenOffer(offer));
} else {
boolean isSellOffer = offer.getDirection() == OfferPayload.Direction.SELL;
iconView.setId(isSellOffer ? "image-buy-white" : "image-sell-white");
button.setId(isSellOffer ? "buy-button" : "sell-button");
button.setStyle("-fx-text-fill: white");
if (isSellOffer) {
title = CurrencyUtil.isFiatCurrency(offer.getCurrencyCode()) ?
Res.get("offerbook.takeOfferToBuy", offer.getOfferPayload().getBaseCurrencyCode()) :

View File

@ -153,7 +153,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
private BusyAnimation waitingForFundsBusyAnimation, offerAvailabilityBusyAnimation;
private Notification walletFundedNotification;
private OfferView.CloseHandler closeHandler;
private Subscription cancelButton2StyleSubscription, balanceSubscription,
private Subscription balanceSubscription,
showTransactionPublishedScreenSubscription, showWarningInvalidBtcDecimalPlacesSubscription,
isWaitingForFundsSubscription, offerWarningSubscription, errorMessageSubscription,
isOfferAvailableSubscription;
@ -760,8 +760,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
});*/
balanceSubscription = EasyBind.subscribe(model.dataModel.getBalance(), balanceTextField::setBalance);
cancelButton2StyleSubscription = EasyBind.subscribe(takeOfferButton.visibleProperty(),
isVisible -> cancelButton2.setId(isVisible ? "cancel-button" : null));
}
private void removeSubscriptions() {
@ -773,7 +771,6 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
showTransactionPublishedScreenSubscription.unsubscribe();
// noSufficientFeeSubscription.unsubscribe();
balanceSubscription.unsubscribe();
cancelButton2StyleSubscription.unsubscribe();
}
private void addListeners() {
@ -1106,7 +1103,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
Res.get("takeOffer.amountPriceBox.priceDescription"));
priceDescriptionLabel = priceInputBoxTuple.first;
getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel);
getSmallIconForLabel(MaterialDesignIcon.LOCK, priceDescriptionLabel, "small-icon-label");
VBox priceBox = priceInputBoxTuple.second;
@ -1145,7 +1142,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
Res.get("shared.distanceInPercent"));
priceAsPercentageDescription = priceAsPercentageInputBoxTuple.first;
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, priceAsPercentageDescription);
getSmallIconForLabel(MaterialDesignIcon.CHART_LINE, priceAsPercentageDescription, "small-icon-label");
priceAsPercentageInputBox = priceAsPercentageInputBoxTuple.second;

View File

@ -385,7 +385,6 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
Button cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
cancelButton.setDefaultButton(false);
cancelButton.setId("cancel-button");
cancelButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(Runnable::run);
hide();

View File

@ -196,7 +196,6 @@ public class EditOfferView extends MutableOfferView<EditOfferViewModel> {
cancelButton = new AutoTooltipButton(Res.get("shared.cancel"));
cancelButton.setDefaultButton(false);
cancelButton.setId("cancel-button");
cancelButton.setOnAction(event -> close());
editOfferConfirmationBox.getChildren().add(cancelButton);

View File

@ -107,11 +107,11 @@
-bs-toggle-selected: #25b135;
-bs-warning: #db6300;
-bs-buy: #2ea33c;
-bs-buy: #006600;
-bs-buy-focus: black;
-bs-buy-hover: #237b2d;
-bs-buy-transparent: rgba(46, 163, 60, 0.3);
-bs-sell: #ee6563;
-bs-sell: #660000;
-bs-sell-focus: #090202;
-bs-sell-hover: #b42522;
-bs-sell-transparent: rgba(216, 52, 49, 0.3);
@ -125,6 +125,9 @@
-bs-green-soft: derive(-bs-rd-green, 60%);
-bs-red-soft: derive(-bs-rd-error-red, 60%);
-bs-progress-bar-track: #272728;
-bs-chart-tick: rgba(255, 255, 255, 0.7);
-bs-chart-lines: rgba(0, 0, 0, 0.3);
-bs-white: white;
}
/* list view */
@ -209,13 +212,6 @@
-fx-border-color: -bs-color-gray-2;
}
#sell-button, #sell-button-big {
-fx-background-color: #660000 !important;
}
#buy-button, #buy-button-big {
-fx-background-color: #006600 !important;
}
.wallet-seed-words {
-fx-text-fill: -bs-color-gray-6;
}
@ -234,12 +230,12 @@
-fx-border-color: transparent transparent transparent transparent;
}
#charts .axis, #price-chart .axis, #volume-chart .axis, #charts-dao .axis {
-fx-tick-label-fill: rgba(255,255,255,0.7);
-fx-tick-label-fill: -bs-chart-tick;
}
.chart-horizontal-grid-lines,
.chart-horizontal-zero-line, .chart-vertical-zero-line,
.axis-tick-mark, .axis-minor-tick-mark {
-fx-stroke: rgba(0,0,0,0.3);
-fx-stroke: -bs-chart-lines;
}
/* scrollbars */
@ -253,11 +249,17 @@
.scroll-bar:vertical .thumb:hover {
-fx-background-color: -bs-color-gray-5;
}
.scroll-bar:horizontal .thumb:pressed,
.scroll-bar:vertical .thumb:pressed {
-fx-background-color: -bs-color-gray-4;
}
.scroll-bar:vertical:focused,
.scroll-bar:horizontal:focused {
-fx-background-color: transparent, -bs-color-gray-4, -bs-color-gray-4;
}
.small-icon-label {
-fx-fill: -bs-text-color;
}

View File

@ -100,4 +100,5 @@
-fx-selection-bar-non-focused: -fx-selection-bar;
-fx-default-button: derive(-fx-accent, 95%);
-bs-progress-bar-track: #e0e0e0;
-bs-white: white;
}

View File

@ -23,10 +23,14 @@ public class CssTheme {
public static final int CSS_THEME_LIGHT = 0;
public static final int CSS_THEME_DARK = 1;
private static int currentCSSTheme;
public static void loadSceneStyles(Scene scene, int cssTheme) {
String cssThemeFolder = "/bisq/desktop/";
String cssThemeFile = "";
currentCSSTheme = cssTheme;
switch (cssTheme) {
case CSS_THEME_DARK:
@ -40,13 +44,18 @@ public class CssTheme {
}
scene.getStylesheets().setAll(
// load base styles first
cssThemeFolder + "bisq.css",
cssThemeFolder + "images.css",
cssThemeFolder + "CandleStickChart.css",
// load base styles first
cssThemeFolder + "bisq.css",
cssThemeFolder + "images.css",
cssThemeFolder + "CandleStickChart.css",
// load theme last to allow override
cssThemeFolder + cssThemeFile
// load theme last to allow override
cssThemeFolder + cssThemeFile
);
}
public static boolean isDarkTheme() {
return currentCSSTheme == CSS_THEME_DARK;
}
}

View File

@ -2045,10 +2045,13 @@ public class FormBuilder {
// Icons
///////////////////////////////////////////////////////////////////////////////////////////
public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label) {
public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label, String style) {
if (icon.fontFamily().equals(MATERIAL_DESIGN_ICONS)) {
final Text textIcon = MaterialDesignIconFactory.get().createIcon(icon, iconSize);
textIcon.setOpacity(0.7);
if (style != null) {
textIcon.getStyleClass().add(style);
}
label.setContentDisplay(ContentDisplay.LEFT);
label.setGraphic(textIcon);
return textIcon;
@ -2057,6 +2060,14 @@ public class FormBuilder {
}
}
public static Text getIconForLabel(GlyphIcons icon, String iconSize, Label label) {
return getIconForLabel(icon, iconSize, label, null);
}
public static Text getSmallIconForLabel(GlyphIcons icon, Label label, String style) {
return getIconForLabel(icon, "0.769em", label, style);
}
public static Text getSmallIconForLabel(GlyphIcons icon, Label label) {
return getIconForLabel(icon, "0.769em", label);
}