Compare commits

...
Author SHA1 Message Date
John Colvin ca00f256e1 ui (DJ): Avoid darkening price text in session range in ladder
Put the session range visual beneath the column backgrounds
(on the z axis), and make the background slightly translucent
while leaving the font color fully opaque.  This effectively
darkens the former without changing the latter.
2021-02-17 12:57:26 -06:00
John Colvin 733ce7dfc6 Set alpha bits to 'FF' in historic ladder settings colors 2021-02-17 12:38:51 -06:00
6 changed files with 38 additions and 14 deletions

No files matched your search

@@ -526,12 +526,12 @@ namespace mbts.spark {
last_column = LadderColumnSettings.Default,
piq_column = LadderColumnSettings.DefaultPiqColumnSettings;
orders_column.background = BTSColors.LadderSpecial.default_column_background;
bid_column.foreground = 0xFFFFFF;
bid_column.foreground = 0xFFFFFFFF;
bid_column.background = BTSColors.MarketData.bid;
ask_column.foreground = 0xFFFFFF;
ask_column.foreground = 0xFFFFFFFF;
ask_column.background = BTSColors.MarketData.ask;
price_column.background = BTSColors.LadderSpecial.default_column_background;
last_column.background = 0xFFFFFF;
last_column.background = 0xFFFFFFFF;
piq_column.background = BTSColors.LadderSpecial.default_column_background;
var rv = new LadderSettings {
row_height = 22,
@@ -593,7 +593,13 @@ namespace mbts.spark {
get {
var rv = historic_default;
rv.orders_column.background = Color.FromRgb(223, 223, 223).rgb_color();
rv.price_column.background = Color.FromRgb(166, 166, 166).rgb_color();
// Since the price column sits atop the session range fill in tt
// mode (normally it is the other way around), the former is made
// partially translucent while the latter is fully opaque (obv the
// top layer cannot be opaque, since it would completely hide the
// layer beneath it).
rv.session_range_fill.color = rv.session_range_fill.color.rgb_color().with(255).rgb_color();
rv.price_column.background = Color.FromArgb(226, 166, 166, 166).rgb_color();
rv.price_column.foreground = Colors.White.rgb_color();
rv.bid_column.background = Color.FromRgb(0, 30, 160).rgb_color();
rv.ask_column.background = Color.FromRgb(160, 0, 0).rgb_color();
@@ -628,8 +628,8 @@ namespace mbts.spark {
font_size = settings.font_size;
width = settings.width;
show = settings.show;
foreground = settings.foreground.rgb_color();
background = settings.background.rgb_color();
foreground = settings.foreground.argb_color();
background = settings.background.argb_color();
}
public LadderColumnSettings get_settings() {
@@ -639,8 +639,8 @@ namespace mbts.spark {
font_weight = font_weight.ToOpenTypeWeight(),
width = width,
show = show,
foreground = new BTSColor(foreground).ToUint(),
background = new BTSColor(background).ToUint()
foreground = foreground.rgb_color(),
background = background.rgb_color()
};
}
}
@@ -1231,6 +1231,18 @@ namespace mbts.spark {
_price_dirty = _settings.price_column.show;
// Clear and re-add the columns to the viewer to ensure offset/visibility is correct
_visualHost.Clear();
if (LadderSettings.mimic_tt) {
// The session_range_vis sits beneath the grid backgrounds (on the
// z-axis) to avoid obfuscating the font color (dj wants it to be
// pure white). Historically, it sat atop the price column, with a
// low opacity to slightly darken the range of prices inside of the
// session range (i.e., the price-band of the day's trades). In
// conjuction with this change, the price column's background
// opacity is made slightly less than 1 (in the default settings),
// while the font color remains fully opaque, so this layer will
// darken the background without affecting the font color.
_visualHost.AddVisualChild(_session_range_vis);
}
// Renders the grid lines and column backgrounds
_visualHost.AddVisualChild(_gridvis);
// Orders column
@@ -1261,7 +1273,8 @@ namespace mbts.spark {
_visualHost.AddVisualChild(_bid_mkt_break_vis);
_visualHost.AddVisualChild(_session_low_vis);
_visualHost.AddVisualChild(_session_high_vis);
_visualHost.AddVisualChild(_session_range_vis);
if (!LadderSettings.mimic_tt)
_visualHost.AddVisualChild(_session_range_vis);
_render_grid_background();
_init_tactile_adorner();
// this effectively sets the background of the "Last" column
@@ -161,8 +161,7 @@ namespace mbts.spark {
using (var dc = dv.RenderOpen()) {
// draw column backgrounds
foreach (var col in columns) {
var background = col.settings.background.rgb_brush();
background.Freeze();
var background = col.settings.background.argb_brush();
dc.DrawRectangle(background, null, new Rect(col.x_left, 0, col.settings.width, rowcount * row_height));
}
// draw grid lines
@@ -412,7 +411,7 @@ namespace mbts.spark {
public static void render_session_range(DrawingVisual dv, uint color, LadderColumnSettings settings, int low_index, int high_index, double[] prices, double row_height) {
using (var dc = dv.RenderOpen())
using (_draw_with_clip(dc, settings, row_height, prices.Length))
dc.DrawRectangle(new SolidColorBrush(color.rgb_color()) { Opacity = 0.1 }, null, new Rect(0, high_index * row_height, settings.width, (low_index - high_index) * row_height));
dc.DrawRectangle(new SolidColorBrush(color.argb_color()), null, new Rect(0, high_index * row_height, settings.width, (low_index - high_index) * row_height));
}
static GlyphRun[] _format_empty_prices(int row_count, double row_height, LadderColumnSettings settings, GlyphContext glyph_context) {
@@ -115,7 +115,7 @@ namespace mbts.ui {
public static BTSColor session_low { get; } = new BTSColor(89, 89, 107);
public static BTSColor session_high { get; } = new BTSColor(35, 155, 0);
public static BTSColor session_range_fill { get; } = Colors.Black;
public static BTSColor session_range_fill { get; } = Color.FromArgb(26, 0, 0, 0);
// Alerts
[DisplayInfo(name = "Trade Alert")]
@@ -731,4 +731,4 @@ namespace mbts.ui {
#endregion
}
}
}
@@ -97,6 +97,12 @@ namespace mbts.ui {
return brush;
}
public static Brush argb_brush(this uint color) {
var brush = new SolidColorBrush(argb_color(color));
brush.Freeze();
return brush;
}
public static SolidColorBrush rgb_solid_brush(this uint color) =>
new SolidColorBrush(rgb_color(color));