|
| 1 | +use gtk::{CssProvider, gdk::Display, STYLE_PROVIDER_PRIORITY_APPLICATION}; |
| 2 | + |
| 3 | +pub fn apply_styles() { |
| 4 | + let provider = CssProvider::new(); |
| 5 | + provider.load_from_data(r#" |
| 6 | + /* Global window styling */ |
| 7 | + window { |
| 8 | + background-color: rgba(18, 18, 18, 0.95); /* Semi-transparent modern dark background */ |
| 9 | + border-radius: 12px; /* Rounded corners for modern look */ |
| 10 | + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); /* Subtle shadow */ |
| 11 | +} |
| 12 | +
|
| 13 | +/* Header bar styling */ |
| 14 | +headerbar { |
| 15 | +background-color: rgba(30, 30, 30, 0.9); |
| 16 | + border-bottom: 1px solid rgba(255, 255, 255, 0.1); |
| 17 | + box-shadow: none; |
| 18 | + padding: 4px; |
| 19 | +} |
| 20 | +
|
| 21 | +/* Notebook and tabs */ |
| 22 | +notebook { |
| 23 | +background-color: transparent; |
| 24 | +border: none; |
| 25 | +} |
| 26 | +
|
| 27 | +notebook tab { |
| 28 | +background-color: rgba(40, 40, 40, 0.8); |
| 29 | + border: 1px solid rgba(255, 255, 255, 0.05); |
| 30 | + border-radius: 8px 8px 0 0; |
| 31 | + padding: 6px 12px; |
| 32 | + margin: 2px; |
| 33 | + transition: background-color 0.2s ease; |
| 34 | +} |
| 35 | +
|
| 36 | +notebook tab:hover { |
| 37 | +background-color: rgba(60, 60, 60, 0.9); |
| 38 | +} |
| 39 | +
|
| 40 | +notebook tab:checked { |
| 41 | +background-color: rgba(80, 80, 80, 0.95); |
| 42 | + border-bottom: none; |
| 43 | +} |
| 44 | +
|
| 45 | +/* Scrolled window */ |
| 46 | +scrolledwindow { |
| 47 | +background-color: transparent; |
| 48 | +border: none; |
| 49 | +} |
| 50 | +
|
| 51 | +/* VTE Terminal styling */ |
| 52 | +vte-terminal { |
| 53 | +background-color: transparent; |
| 54 | +color: #e0e0e0; /* Light gray text for readability */ |
| 55 | +font-family: 'JetBrains Mono', monospace; /* Modern monospace font */ |
| 56 | +font-size: 13pt; |
| 57 | +padding: 10px; |
| 58 | +border-radius: 8px; |
| 59 | +} |
| 60 | +
|
| 61 | +/* Buttons */ |
| 62 | +button { |
| 63 | +background-color: rgba(50, 50, 50, 0.8); |
| 64 | + border: 1px solid rgba(255, 255, 255, 0.1); |
| 65 | + border-radius: 6px; |
| 66 | + padding: 4px 8px; |
| 67 | + transition: background-color 0.2s ease; |
| 68 | +} |
| 69 | +
|
| 70 | +button:hover { |
| 71 | +background-color: rgba(70, 70, 70, 0.9); |
| 72 | +} |
| 73 | +
|
| 74 | +/* Close button in tabs */ |
| 75 | +button.flat { |
| 76 | +background: none; |
| 77 | +border: none; |
| 78 | +color: #ff5555; /* Red for close */ |
| 79 | +} |
| 80 | +
|
| 81 | +button.flat:hover { |
| 82 | +color: #ff7777; |
| 83 | +} |
| 84 | +
|
| 85 | +/* Overlay for webview */ |
| 86 | +overlay { |
| 87 | +background-color: transparent; |
| 88 | +} |
| 89 | +"#); |
| 90 | + |
| 91 | + gtk::style_context_add_provider_for_display( |
| 92 | + &Display::default().expect("No GDK Display"), |
| 93 | + &provider, |
| 94 | + STYLE_PROVIDER_PRIORITY_APPLICATION, |
| 95 | + ); |
| 96 | +} |
0 commit comments