mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
UWP console: force white background
This commit is contained in:
parent
c76d1318f3
commit
1c2ac3f2a1
4 changed files with 15 additions and 14 deletions
|
@ -283,16 +283,16 @@ void BrowserPage::ClearConsole() {
|
||||||
void BrowserPage::OnDevtoolsMessage(DevtoolsMessageLevel level, hstring source,
|
void BrowserPage::OnDevtoolsMessage(DevtoolsMessageLevel level, hstring source,
|
||||||
hstring body) {
|
hstring body) {
|
||||||
Dispatcher().RunAsync(CoreDispatcherPriority::High, [=] {
|
Dispatcher().RunAsync(CoreDispatcherPriority::High, [=] {
|
||||||
auto fgColor = UI::Colors::White();
|
auto dotColor = UI::Colors::Transparent();
|
||||||
auto bgColor = UI::Colors::White();
|
auto bgColor = UI::Colors::Transparent();
|
||||||
if (level == servo::DevtoolsMessageLevel::Error) {
|
if (level == servo::DevtoolsMessageLevel::Error) {
|
||||||
fgColor = UI::Colors::Red();
|
dotColor = UI::Colors::Red();
|
||||||
bgColor = UI::Colors::LightPink();
|
bgColor = UI::Colors::LightPink();
|
||||||
} else if (level == servo::DevtoolsMessageLevel::Warn) {
|
} else if (level == servo::DevtoolsMessageLevel::Warn) {
|
||||||
fgColor = UI::Colors::Orange();
|
dotColor = UI::Colors::Orange();
|
||||||
bgColor = UI::Colors::LightYellow();
|
bgColor = UI::Colors::LightYellow();
|
||||||
}
|
}
|
||||||
mLogs.Append(make<ConsoleLog>(fgColor, bgColor, body, source));
|
mLogs.Append(make<ConsoleLog>(dotColor, bgColor, body, source));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,18 +64,19 @@ private:
|
||||||
|
|
||||||
struct ConsoleLog : ConsoleLogT<ConsoleLog> {
|
struct ConsoleLog : ConsoleLogT<ConsoleLog> {
|
||||||
public:
|
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) {
|
: mSource(s), mBody(b) {
|
||||||
mFgColor = UI::Xaml::Media::SolidColorBrush(fg);
|
mDotColor = UI::Xaml::Media::SolidColorBrush(dot);
|
||||||
mBgColor = UI::Xaml::Media::SolidColorBrush(bg);
|
mBgColor = UI::Xaml::Media::SolidColorBrush(bg);
|
||||||
};
|
};
|
||||||
SolidColorBrush FgColor() { return mFgColor; };
|
SolidColorBrush DotColor() { return mDotColor; };
|
||||||
SolidColorBrush BgColor() { return mBgColor; };
|
SolidColorBrush BgColor() { return mBgColor; };
|
||||||
hstring Source() { return mSource; };
|
hstring Source() { return mSource; };
|
||||||
hstring Body() { return mBody; };
|
hstring Body() { return mBody; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SolidColorBrush mFgColor;
|
SolidColorBrush mDotColor;
|
||||||
SolidColorBrush mBgColor;
|
SolidColorBrush mBgColor;
|
||||||
hstring mSource;
|
hstring mSource;
|
||||||
hstring mBody;
|
hstring mBody;
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace ServoApp
|
||||||
|
|
||||||
runtimeclass ConsoleLog
|
runtimeclass ConsoleLog
|
||||||
{
|
{
|
||||||
ConsoleLog(Windows.UI.Color fgColor, Windows.UI.Color bgColor, String body, String source);
|
ConsoleLog(Windows.UI.Color dotColor, Windows.UI.Color bgColor, String body, String source);
|
||||||
Windows.UI.Xaml.Media.SolidColorBrush FgColor { get; };
|
Windows.UI.Xaml.Media.SolidColorBrush DotColor { get; };
|
||||||
Windows.UI.Xaml.Media.SolidColorBrush BgColor { get; };
|
Windows.UI.Xaml.Media.SolidColorBrush BgColor { get; };
|
||||||
String Body{ get; };
|
String Body{ get; };
|
||||||
String Source{ get; };
|
String Source{ get; };
|
||||||
|
|
|
@ -155,7 +155,7 @@
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<ListView ItemsSource="{x:Bind ConsoleLogs}">
|
<ListView ItemsSource="{x:Bind ConsoleLogs}" Background="White">
|
||||||
<ListView.ItemsPanel>
|
<ListView.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
<ItemsStackPanel Orientation="Vertical" ItemsUpdatingScrollMode="KeepLastItemInView"/>
|
<ItemsStackPanel Orientation="Vertical" ItemsUpdatingScrollMode="KeepLastItemInView"/>
|
||||||
|
@ -169,8 +169,8 @@
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Ellipse Width="8" Height="8" Fill="{x:Bind FgColor}" Grid.Column="0" Margin="10,0"/>
|
<Ellipse Width="8" Height="8" Fill="{x:Bind DotColor}" Grid.Column="0" Margin="10,0"/>
|
||||||
<TextBlock FontFamily="Consolas" FontSize="12" Text="{x:Bind Body}" Grid.Column="1"/>
|
<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"/>
|
<TextBlock FontFamily="Consolas" FontSize="12" Text="{x:Bind Source}" Foreground="Gray" Grid.Column="2" Margin="10,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue