Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
UWP console: force white background
  • Loading branch information
paulrouget committed Jun 23, 2020
1 parent c76d131 commit 1c2ac3f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions support/hololens/ServoApp/BrowserPage.cpp
Expand Up @@ -283,16 +283,16 @@ void BrowserPage::ClearConsole() {
void BrowserPage::OnDevtoolsMessage(DevtoolsMessageLevel level, hstring source,
hstring body) {
Dispatcher().RunAsync(CoreDispatcherPriority::High, [=] {
auto fgColor = UI::Colors::White();
auto bgColor = UI::Colors::White();
auto dotColor = UI::Colors::Transparent();
auto bgColor = UI::Colors::Transparent();
if (level == servo::DevtoolsMessageLevel::Error) {
fgColor = UI::Colors::Red();
dotColor = UI::Colors::Red();
bgColor = UI::Colors::LightPink();
} else if (level == servo::DevtoolsMessageLevel::Warn) {
fgColor = UI::Colors::Orange();
dotColor = UI::Colors::Orange();
bgColor = UI::Colors::LightYellow();
}
mLogs.Append(make<ConsoleLog>(fgColor, bgColor, body, source));
mLogs.Append(make<ConsoleLog>(dotColor, bgColor, body, source));
});
}

Expand Down
9 changes: 5 additions & 4 deletions support/hololens/ServoApp/BrowserPage.h
Expand Up @@ -64,18 +64,19 @@ struct BrowserPage : BrowserPageT<BrowserPage>, public servo::DevtoolsDelegate {

struct ConsoleLog : ConsoleLogT<ConsoleLog> {
public:
ConsoleLog(Windows::UI::Color fg, Windows::UI::Color bg, hstring b, hstring s)
ConsoleLog(Windows::UI::Color dot, Windows::UI::Color bg, hstring b,
hstring s)
: mSource(s), mBody(b) {
mFgColor = UI::Xaml::Media::SolidColorBrush(fg);
mDotColor = UI::Xaml::Media::SolidColorBrush(dot);
mBgColor = UI::Xaml::Media::SolidColorBrush(bg);
};
SolidColorBrush FgColor() { return mFgColor; };
SolidColorBrush DotColor() { return mDotColor; };
SolidColorBrush BgColor() { return mBgColor; };
hstring Source() { return mSource; };
hstring Body() { return mBody; };

private:
SolidColorBrush mFgColor;
SolidColorBrush mDotColor;
SolidColorBrush mBgColor;
hstring mSource;
hstring mBody;
Expand Down
4 changes: 2 additions & 2 deletions support/hololens/ServoApp/BrowserPage.idl
Expand Up @@ -9,8 +9,8 @@ namespace ServoApp

runtimeclass ConsoleLog
{
ConsoleLog(Windows.UI.Color fgColor, Windows.UI.Color bgColor, String body, String source);
Windows.UI.Xaml.Media.SolidColorBrush FgColor { get; };
ConsoleLog(Windows.UI.Color dotColor, Windows.UI.Color bgColor, String body, String source);
Windows.UI.Xaml.Media.SolidColorBrush DotColor { get; };
Windows.UI.Xaml.Media.SolidColorBrush BgColor { get; };
String Body{ get; };
String Source{ get; };
Expand Down
6 changes: 3 additions & 3 deletions support/hololens/ServoApp/BrowserPage.xaml
Expand Up @@ -155,7 +155,7 @@
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<ListView ItemsSource="{x:Bind ConsoleLogs}">
<ListView ItemsSource="{x:Bind ConsoleLogs}" Background="White">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsStackPanel Orientation="Vertical" ItemsUpdatingScrollMode="KeepLastItemInView"/>
Expand All @@ -169,8 +169,8 @@
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Ellipse Width="8" Height="8" Fill="{x:Bind FgColor}" Grid.Column="0" Margin="10,0"/>
<TextBlock FontFamily="Consolas" FontSize="12" Text="{x:Bind Body}" Grid.Column="1"/>
<Ellipse Width="8" Height="8" Fill="{x:Bind DotColor}" Grid.Column="0" Margin="10,0"/>
<TextBlock FontFamily="Consolas" FontSize="12" Text="{x:Bind Body}" Foreground="Black" Grid.Column="1"/>
<TextBlock FontFamily="Consolas" FontSize="12" Text="{x:Bind Source}" Foreground="Gray" Grid.Column="2" Margin="10,0"/>
</Grid>
</DataTemplate>
Expand Down

0 comments on commit 1c2ac3f

Please sign in to comment.