mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +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,
|
||||
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));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -64,18 +64,19 @@ private:
|
|||
|
||||
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;
|
||||
|
|
|
@ -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; };
|
||||
|
|
|
@ -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"/>
|
||||
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue