mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:37:35 +00:00
Ladybird/AppKit: Remove theme color changing background color
This commit is contained in:
parent
2107ab823d
commit
980e32b4fe
3 changed files with 1 additions and 26 deletions
|
@ -26,7 +26,6 @@
|
||||||
- (void)loadURL:(URL const&)url;
|
- (void)loadURL:(URL const&)url;
|
||||||
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect;
|
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect;
|
||||||
- (void)onLoadFinish:(URL const&)url;
|
- (void)onLoadFinish:(URL const&)url;
|
||||||
- (void)onThemeColorChange:(Color)color;
|
|
||||||
|
|
||||||
- (void)onTitleChange:(DeprecatedString const&)title;
|
- (void)onTitleChange:(DeprecatedString const&)title;
|
||||||
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap;
|
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap;
|
||||||
|
|
|
@ -668,11 +668,7 @@ static void copy_data_to_clipboard(StringView data, NSPasteboardType pasteboard_
|
||||||
};
|
};
|
||||||
|
|
||||||
m_web_view_bridge->on_theme_color_change = [self](auto color) {
|
m_web_view_bridge->on_theme_color_change = [self](auto color) {
|
||||||
self.backgroundColor = [NSColor colorWithRed:(color.red() / 255.0)
|
self.backgroundColor = Ladybird::gfx_color_to_ns_color(color);
|
||||||
green:(color.green() / 255.0)
|
|
||||||
blue:(color.blue() / 255.0)
|
|
||||||
alpha:1.0];
|
|
||||||
[self.observer onThemeColorChange:color];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
m_web_view_bridge->on_insert_clipboard_entry = [](auto const& data, auto const&, auto const& mime_type) {
|
m_web_view_bridge->on_insert_clipboard_entry = [](auto const& data, auto const&, auto const& mime_type) {
|
||||||
|
|
|
@ -100,8 +100,6 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
||||||
object:[scroll_view contentView]];
|
object:[scroll_view contentView]];
|
||||||
|
|
||||||
[self setContentView:scroll_view];
|
[self setContentView:scroll_view];
|
||||||
self.backgroundColor = [NSColor windowBackgroundColor];
|
|
||||||
self.titlebarAppearsTransparent = YES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
@ -226,7 +224,6 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
||||||
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect
|
- (void)onLoadStart:(URL const&)url isRedirect:(BOOL)is_redirect
|
||||||
{
|
{
|
||||||
if (url != self.last_url) {
|
if (url != self.last_url) {
|
||||||
self.backgroundColor = [NSColor windowBackgroundColor];
|
|
||||||
self.last_url = url;
|
self.last_url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,23 +255,6 @@ static constexpr CGFloat const WINDOW_HEIGHT = 800;
|
||||||
[self updateTabTitleAndFavicon];
|
[self updateTabTitleAndFavicon];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)onThemeColorChange:(Color)color
|
|
||||||
{
|
|
||||||
auto* nscolor = [NSColor colorWithRed:((CGFloat)color.red()) / 255.0
|
|
||||||
green:((CGFloat)color.green()) / 255.0
|
|
||||||
blue:((CGFloat)color.blue()) / 255.0
|
|
||||||
alpha:1.0];
|
|
||||||
CGFloat hue = 0.0;
|
|
||||||
CGFloat saturation = 0.0;
|
|
||||||
CGFloat brightness = 0.0;
|
|
||||||
[nscolor getHue:&hue saturation:&saturation brightness:&brightness alpha:nil];
|
|
||||||
if (brightness > 0.75)
|
|
||||||
brightness = 0.75;
|
|
||||||
nscolor = [NSColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1.0];
|
|
||||||
self.backgroundColor = nscolor;
|
|
||||||
self.titlebarAppearsTransparent = YES;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap
|
- (void)onFaviconChange:(Gfx::Bitmap const&)bitmap
|
||||||
{
|
{
|
||||||
static constexpr size_t FAVICON_SIZE = 16;
|
static constexpr size_t FAVICON_SIZE = 16;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue