android_webview
apps
ash
base
build
build_overrides
buildtools
cc
chrome
chromecast
chromeos
cloud_print
components
content
courgette
crypto
dbus
device
docs
accessibility
autofill
design
enterprise
gpu
images
infra
ios
login
mac
media
memory
memory-infra
patterns
privacy
process
security
speed
sync
testing
ui
workflow
xr
OWNERS
README.md
accessibility.md
ad_tagging.md
adding_to_third_party.md
android_accessing_cpp_enums_in_java.md
android_accessing_cpp_switches_in_java.md
android_build_instructions.md
android_cast_build_instructions.md
android_debugging_instructions.md
android_dynamic_feature_modules.md
android_emulator.md
android_logging.md
android_native_libraries.md
android_studio.md
angle_in_chromium.md
atom.md
bitmap_pipeline.md
building_old_revisions.md
callback.md
ccache_mac.md
chrome_os_logging.md
chrome_settings.md
chromedriver_status.md
chromeos_build_instructions.md
chromeos_glossary.md
chromium_browser_vs_google_chrome.md
chromoting_android_hacking.md
cipd.md
cl_respect.md
clang.md
clang_code_coverage_wrapper.md
clang_format.md
clang_sheriffing.md
clang_static_analyzer.md
clang_tidy.md
clang_tool_refactoring.md
clangd.md
clion_dev.md
closure_compilation.md
cocoa_tips_and_tricks.md
code_reviews.md
commit_checklist.md
component_build.md
configuration.md
contributing.md
cr_respect.md
cr_user_manual.md
cross_platform_ui.md
cygwin_dll_remapping_failure.md
debugging_with_crash_keys.md
deterministic_builds.md
disassemble_code.md
documentation_best_practices.md
documentation_guidelines.md
eclipse.md
emacs.md
erc_irc.md
flag_expiry.md
flag_ownership.md
fuchsia_build_instructions.md
fuchsia_gardening.md
fuchsia_sdk_updates.md
gdbinit.md
get_the_code.md
git_cookbook.md
git_tips.md
google_chrome_branded_builds.md
google_play_services.md
graphical_debugging_aid_chromium_views.md
gwp_asan.md
how_cc_works.md
how_to_add_your_feature_flag.md
how_to_extend_web_test_framework.md
initialize_blink_features.md
inlined_stack_traces.md
installation_at_vmware.md
ios_build_instructions.md
ios_infra.md
ios_voiceover.md
jumbo.md
kiosk_mode.md
linux_build_instructions.md
linux_building_debug_gtk.md
linux_cast_build_instructions.md
linux_cert_management.md
linux_chromium_arm.md
linux_chromium_packages.md
linux_crash_dumping.md
linux_debugging.md
linux_debugging_gtk.md
linux_debugging_ssl.md
linux_dev_build_as_default_browser.md
linux_development.md
linux_eclipse_dev.md
linux_graphics_pipeline.md
linux_gtk_theme_integration.md
linux_hw_video_decode.md
linux_minidump_to_core.md
linux_password_storage.md
linux_pid_namespace_support.md
linux_plugins.md
linux_profiling.md
linux_proxy_config.md
linux_sandbox_ipc.md
linux_sandboxing.md
linux_suid_sandbox.md
linux_suid_sandbox_development.md
linux_sysroot.md
linux_zygote.md
lldbinit.md
luci_migration_faq.md
mac_build_instructions.md
mojo_and_services.md
mojo_ipc_conversion.md
native_relocations.md
network_traffic_annotations.md
new_port_policy.md
no_sources_assignment_filter.md
old_chromoting_build_instructions.md
optimizing_web_uis.md
optional.md
origin_trials_integration.md
ozone_drm_for_linux.md
ozone_overview.md
parsing_test_results.md
piranha_plant.md
profiling.md
profiling_content_shell_on_android.md
proxy_auto_config.md
qtcreator.md
release_branch_guidance.md
seccomp_sandbox_crash_dumping.md
servicification.md
sheriff.md
static_initializers.md
sublime_ide.md
system_hardening_features.md
tab_helpers.md
threading_and_tasks.md
threading_and_tasks_faq.md
threading_and_tasks_testing.md
tour_of_luci_ui.md
tpm_quick_ref.md
translation_screenshots.md
updating_clang.md
updating_clang_format_binaries.md
use_counter_wiki.md
useful_urls.md
user_data_dir.md
user_handle_mapping.md
using_a_linux_chroot.md
using_build_runner.md
vanilla_msysgit_workflow.md
vscode.md
webui_explainer.md
webui_in_components.md
webview_policies.md
win_cross.md
win_order_files.md
windows_build_instructions.md
windows_split_dll.md
working_remotely_with_android.md
writing_clang_plugins.md
extensions
fuchsia
gin
google_apis
google_update
gpu
headless
infra
ios
ipc
jingle
media
mojo
native_client_sdk
net
pdf
ppapi
printing
remoting
rlz
sandbox
services
skia
sql
storage
styleguide
testing
third_party
tools
ui
url
weblayer
.clang-format
.clang-tidy
.eslintrc.js
.git-blame-ignore-revs
.gitattributes
.gitignore
.gn
.vpython
.vpython3
AUTHORS
BUILD.gn
CODE_OF_CONDUCT.md
DEPS
ENG_REVIEW_OWNERS
LICENSE
LICENSE.chromium_os
OWNERS
PRESUBMIT.py
PRESUBMIT_test.py
PRESUBMIT_test_mocks.py
README.md
WATCHLISTS
codereview.settings

GTK2 code was historically kept around to keep the electron build working. But as of Nov 26, 2017, electron now uses GTK3 [1], so it should now be safe to remove all of the old GTK2-only code. [1] https://github.com/electron/electron/issues/2927#issuecomment-347092515 BUG=876558 R=sky Change-Id: I78402053ae508ccd8fc7ac73697a861bb1ebacf6 Reviewed-on: https://chromium-review.googlesource.com/1183858 Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/master@{#585265}
53 lines
1.8 KiB
Markdown
53 lines
1.8 KiB
Markdown
# Linux GTK Theme Integration
|
|
|
|
The GTK+ port of Chromium has a mode where we try to match the user's GTK theme
|
|
(which can be enabled under Settings -> Appearance -> Use GTK+ theme).
|
|
|
|
## How Chromium determines which colors to use
|
|
|
|
GTK3 added a new CSS theming engine which gives fine-tuned control over how
|
|
widgets are styled. Chromium's themes, by contrast, are much simpler: it is
|
|
mostly a list of about 80 colors (see //src/ui/native_theme/native_theme.h)
|
|
overridden by the theme. Chromium usually doesn't use GTK to render entire
|
|
widgets, but instead tries to determine colors from them.
|
|
|
|
Chromium needs foreground, background and border colors from widgets. The
|
|
foreground color is simply taken from the CSS "color" property. Backgrounds and
|
|
borders are complicated because in general they might have multiple gradients or
|
|
images. To get the color, Chromium uses GTK to render the background or border
|
|
into a 24x24 bitmap and uses the average color for theming. This mostly gives
|
|
reasonable results, but in case theme authors do not like the resulting color,
|
|
they have the option to theme Chromium widgets specially.
|
|
|
|
## Note to GTK theme authors: How to theme Chromium widgets
|
|
|
|
Every widget Chromium uses will have a "chromium" style class added to it. For
|
|
example, a textfield selector might look like:
|
|
|
|
```
|
|
.window.background.chromium .entry.chromium
|
|
```
|
|
|
|
If themes want to handle Chromium textfields specially, for GTK3.0 - GTK3.19,
|
|
they might use:
|
|
|
|
```
|
|
/* Normal case */
|
|
.entry {
|
|
color: #ffffff;
|
|
background-color: #000000;
|
|
}
|
|
|
|
/* Chromium-specific case */
|
|
.entry.chromium {
|
|
color: #ff0000;
|
|
background-color: #00ff00;
|
|
}
|
|
```
|
|
|
|
For GTK3.20 or later, themes will as usual have to replace ".entry" with
|
|
"entry".
|
|
|
|
The list of CSS selectors that Chromium uses to determine its colors is in
|
|
//src/chrome/browser/ui/libgtkui/native_theme_gtk.cc.
|