diff --git a/apostrophe/application.py b/apostrophe/application.py
index 6aaf2363a00e17d76c3e7c70130ade90c23e3f1f..1a57e2b37735b03835c7e69716db0a0159e56a79 100644
--- a/apostrophe/application.py
+++ b/apostrophe/application.py
@@ -12,7 +12,6 @@
import gi
-
gi.require_version('Gtk', '3.0')
gi.require_version('Handy', '1')
from gi.repository import GLib, Gio, Gtk, Handy
@@ -23,7 +22,6 @@ from apostrophe.helpers import set_up_logging
from apostrophe.preferences_dialog import PreferencesDialog
from apostrophe.inhibitor import Inhibitor
-
class Application(Gtk.Application):
def __init__(self, application_id, *args, **kwargs):
@@ -46,7 +44,6 @@ class Application(Gtk.Application):
Gtk.Application.do_startup(self)
self.settings.connect("changed", self.on_settings_changed)
- self._set_dark_mode()
# Header bar
@@ -135,8 +132,8 @@ class Application(Gtk.Application):
stat_default = self.settings.get_string("stat-default")
action = Gio.SimpleAction.new_stateful(
- "stat_default", GLib.VariantType.new("s"),
- GLib.Variant.new_string(stat_default))
+ "stat_default", GLib.VariantType.new("s"),
+ GLib.Variant.new_string(stat_default))
action.connect("activate", self.on_stat_default)
self.add_action(action)
@@ -144,9 +141,9 @@ class Application(Gtk.Application):
preview_mode = self.settings.get_string("preview-mode")
action = Gio.SimpleAction.new_stateful(
- "preview_mode",
- GLib.VariantType.new("s"),
- GLib.Variant.new_string(preview_mode))
+ "preview_mode",
+ GLib.VariantType.new("s"),
+ GLib.Variant.new_string(preview_mode))
action.connect("activate", self.on_preview_mode)
self.add_action(action)
@@ -171,6 +168,21 @@ class Application(Gtk.Application):
# Inhibitor
self.inhibitor = Inhibitor()
+ # Hardcode Adwaita and respect High Contrast when needed
+ self.set_theme()
+ self.settings.connect("changed", self.set_theme)
+
+ def set_theme(self, *args, **kwargs):
+ gtksettings = Gtk.Settings.get_default()
+ cs = self.settings.get_string("color-scheme")
+
+ if gtksettings.props.gtk_theme_name == "HighContrast" and cs == "dark":
+ gtksettings.props.gtk_theme_name = "HighContrastInverse"
+ elif gtksettings.props.gtk_theme_name == "HighContrastInverse" and not cs == "dark":
+ gtksettings.props.gtk_theme_name = "HighContrast"
+ else:
+ gtksettings.gtk_theme_name = "Adwaita"
+
def do_activate(self, *args, **kwargs):
# We only allow a single window and raise any existing ones
if not self.window:
@@ -193,21 +205,8 @@ class Application(Gtk.Application):
self.activate()
self.window.load_file(files[0])
- def _set_dark_mode(self):
- dark = self.settings.get_value("dark-mode")
- settings = Gtk.Settings.get_default()
-
- settings.props.gtk_application_prefer_dark_theme = dark
-
- if settings.props.gtk_theme_name == "HighContrast" and dark:
- settings.props.gtk_theme_name = "HighContrastInverse"
- elif settings.props.gtk_theme_name == "HighContrastInverse" and not dark:
- settings.props.gtk_theme_name = "HighContrast"
-
def on_settings_changed(self, settings, key):
- if key == "dark-mode":
- self._set_dark_mode()
- elif key == "spellcheck":
+ if key == "spellcheck":
self.window.toggle_spellcheck(settings.get_value(key))
elif key == "input-format":
self.window.reload_preview()
diff --git a/apostrophe/export_dialog.py b/apostrophe/export_dialog.py
index 45e448fd829b803928546deed2c0a9b5031061f3..92593e240e2d8d286f04638d1dc635b21c54c17c 100644
--- a/apostrophe/export_dialog.py
+++ b/apostrophe/export_dialog.py
@@ -33,7 +33,7 @@ gi.require_version('Handy', '1')
from gi.repository import Gtk, Gdk, Gio, GObject, Handy
from apostrophe import helpers
-from apostrophe.theme import Theme
+from apostrophe.settings import Settings
LOGGER = logging.getLogger('apostrophe')
@@ -71,6 +71,16 @@ class ExportDialog:
__gtype_name__ = "ExportDialog"
+ settings = Settings.new()
+ vs = settings.get_string("color-scheme")
+
+ if vs == "light":
+ web_css_path = helpers.get_media_path('/media/css/web/adwaita.css')
+ elif vs == "sepia":
+ web_css_path = helpers.get_media_path('/media/css/web/adwaita-sepia.css')
+ elif vs == "dark":
+ web_css_path = helpers.get_media_path('/media/css/web/adwaita-dark.css')
+
formats = {
"pdf":
{
@@ -88,7 +98,7 @@ class ExportDialog:
"to": "html5",
"mimetype": "text/html",
"args": ["--self-contained",
- "--css=%s" % Theme.get_current().web_css_path,
+ "--css=%s" % web_css_path,
"--mathjax",
"--lua-filter=%s"
% helpers.get_media_path('/lua/relative_to_absolute.lua'),
@@ -384,7 +394,17 @@ class AdvancedExportDialog(Handy.Window):
"/reference_files/reference-a4." + fmt))
if self.show_html_options:
- args.append("--css=%s" % Theme.get_current().web_css_path)
+ settings = Settings.new()
+ vs = settings.get_string("color-scheme")
+
+ if vs == "light":
+ web_css_path = helpers.get_media_path('/media/css/web/adwaita.css')
+ elif vs == "sepia":
+ web_css_path = helpers.get_media_path('/media/css/web/adwaita-sepia.css')
+ elif vs == "dark":
+ web_css_path = helpers.get_media_path('/media/css/web/adwaita-dark.css')
+
+ args.append("--css=%s" % web_css_path)
args.append("--mathjax")
args.append("--lua-filter=%s" % helpers.get_media_path(
'/lua/relative_to_absolute.lua'))
diff --git a/apostrophe/headerbars.py b/apostrophe/headerbars.py
index 7d02350b352752d1f0038f8dea5476b41505dce2..8193456565db34a266331e9c65c61c3b15f0a4a5 100644
--- a/apostrophe/headerbars.py
+++ b/apostrophe/headerbars.py
@@ -25,7 +25,6 @@ from gi.repository import Gtk, GLib
from apostrophe.helpers import get_descendant
from apostrophe.settings import Settings
-
class BaseHeaderbar:
"""Base class for all headerbars
"""
@@ -79,21 +78,23 @@ class BaseHeaderbar:
self.menu_button.set_popover(model)
self.light_button = self.builder.get_object("light_mode_button")
+ self.sepia_button = self.builder.get_object("sepia_mode_button")
self.dark_button = self.builder.get_object("dark_mode_button")
- add_menus(self, app)
-
- settings = Gtk.Settings.get_default()
+ vs = self.settings.get_string("color-scheme")
- if global_dark := settings.props.gtk_theme_name.endswith("-dark"):
- self.light_button.set_sensitive(False)
- self.light_button.set_tooltip_text(_(
- "Light mode isn’t available while using a dark global theme"))
+ if vs == "light":
+ self.light_button.set_active(True)
+ elif vs == "sepia":
+ self.sepia_button.set_active(True)
+ elif vs == "dark":
+ self.dark_button.set_active(True)
- self.dark_button.set_active(self.settings.get_boolean("dark-mode")
- or global_dark)
+ add_menus(self, app)
- self.light_button.connect("toggled", self.__on_dark_mode)
+ self.light_button.connect("toggled", self.__on_light_mode)
+ self.dark_button.connect("toggled", self.__on_dark_mode)
+ self.sepia_button.connect("toggled", self.__on_sepia_mode)
self.select_preview_layout_row()
@@ -160,8 +161,14 @@ class BaseHeaderbar:
self.settings.set_boolean("sync-scroll", state)
return False
+ def __on_light_mode(self, _):
+ self.settings.set_string("color-scheme", "light")
+
+ def __on_sepia_mode(self, _):
+ self.settings.set_string("color-scheme", "sepia")
+
def __on_dark_mode(self, _):
- self.settings.set_boolean("dark-mode", self.dark_button.get_active())
+ self.settings.set_string("color-scheme", "dark")
class MainHeaderbar(BaseHeaderbar): # pylint: disable=too-few-public-methods
diff --git a/apostrophe/helpers.py b/apostrophe/helpers.py
index d14532e31dbb89d8ce011674ad20734a307c3b2c..28f9979d4dd5150dc1d54bff924619a992b2ae2b 100644
--- a/apostrophe/helpers.py
+++ b/apostrophe/helpers.py
@@ -26,11 +26,10 @@ from gettext import gettext as _
import gi
import pypandoc
-from gi.overrides.Pango import Pango
gi.require_version('Gtk', '3.0')
gi.require_version('Handy', '1')
-from gi.repository import Gtk, Gio, Handy # pylint: disable=E0611
+from gi.repository import Gtk, Gio, Handy, Pango # pylint: disable=E0611
from apostrophe.settings import Settings
from apostrophe import config
diff --git a/apostrophe/main_window.py b/apostrophe/main_window.py
index 5bebe2bc66236b051cf0739a59a7d228f9823d42..6d311be1b6d9d9752f9c3f02af97bfa0c9c06f93 100644
--- a/apostrophe/main_window.py
+++ b/apostrophe/main_window.py
@@ -34,10 +34,12 @@ from apostrophe.search_and_replace import SearchAndReplace
from apostrophe.settings import Settings
from apostrophe.tweener import Tweener
from apostrophe.helpers import App
+from apostrophe import headerbars
from apostrophe import helpers
+
+
# from apostrophe.sidebar import Sidebar
-from . import headerbars
LOGGER = logging.getLogger('apostrophe')
@@ -89,6 +91,11 @@ class MainWindow(StyledWindow):
GObject.BindingFlags.BIDIRECTIONAL
| GObject.BindingFlags.SYNC_CREATE)
+ self.headerbar.sepia_button.bind_property(
+ "active", self.fs_headerbar.sepia_button, "active",
+ GObject.BindingFlags.BIDIRECTIONAL |
+ GObject.BindingFlags.SYNC_CREATE)
+
self.headerbar.dark_button.bind_property(
"active", self.fs_headerbar.dark_button, "active",
GObject.BindingFlags.BIDIRECTIONAL |
@@ -133,6 +140,9 @@ class MainWindow(StyledWindow):
self.stats_button = builder.get_object('editor_stats_button')
self.stats_handler = StatsHandler(self.stats_button, self.text_view)
+ self.on_style_changed()
+ self.settings.connect("changed", self.on_style_changed)
+
# Setup preview
content = builder.get_object('content')
editor = builder.get_object('editor')
@@ -172,6 +182,15 @@ class MainWindow(StyledWindow):
self.new_document()
+ def on_style_changed(self, *_):
+ vs = self.settings.get_string("color-scheme")
+ style_context = self.stats_button.get_style_context()
+
+ if vs == "sepia":
+ style_context.add_class('apostrophe-stats-button-sepia')
+ elif vs != "sepia":
+ style_context.remove_class('apostrophe-stats-button-sepia')
+
def header_size_allocate(self, widget, allocation):
""" When the main hb starts to shrink its size, add that size
to the textview margin, so it stays in place
diff --git a/apostrophe/preview_converter.py b/apostrophe/preview_converter.py
index 078201e452eb44ac78788471147f192a4abce7e7..8b24ff6dd727056d1a5e7636cb0aba5b48d89fd7 100644
--- a/apostrophe/preview_converter.py
+++ b/apostrophe/preview_converter.py
@@ -1,10 +1,10 @@
from queue import Queue
from threading import Thread
-from gi.repository import GLib
+from gi.repository import GLib, Gtk
from apostrophe import helpers
-from apostrophe.theme import Theme
+from apostrophe.settings import Settings
class PreviewConverter:
@@ -40,13 +40,34 @@ class PreviewConverter:
if self.queue.empty():
break
+ settings = Settings.new()
+ gtksettings = Gtk.Settings.get_default()
+ cs = settings.get_string("color-scheme")
+
+ if cs == "light":
+ if gtksettings.props.gtk_theme_name == "HighContrast":
+ web_css_path = helpers.get_media_path(
+ '/media/css/web/highcontrast.css')
+ else:
+ web_css_path = helpers.get_media_path(
+ '/media/css/web/adwaita.css')
+ elif cs == "sepia":
+ web_css_path = helpers.get_media_path(
+ '/media/css/web/adwaita-sepia.css')
+ elif cs == "dark":
+ if gtksettings.props.gtk_theme_name == "HighContrastInverse":
+ web_css_path = helpers.get_media_path(
+ '/media/css/web/highcontrastinverse.css')
+ else:
+ web_css_path = helpers.get_media_path(
+ '/media/css/web/adwaita-dark.css')
+
args = ['--standalone',
'--mathjax',
- '--css=' + Theme.get_current().web_css_path,
+ '--css=' + web_css_path,
'--lua-filter=' +
helpers.get_media_path('/lua/relative_to_absolute.lua'),
- '--lua-filter=' +
- helpers.get_media_path('/lua/task-list.lua')]
+ '--lua-filter=' + helpers.get_media_path('/lua/task-list.lua')]
text = helpers.pandoc_convert(text, to="html5", args=args)
GLib.idle_add(callback, text, *user_data)
diff --git a/apostrophe/preview_handler.py b/apostrophe/preview_handler.py
index 746e4bd03e91e622c048cbb5e17e591f9926719d..38486aeda4fc3dc1f2795b6caa0007d0a01a0a15 100644
--- a/apostrophe/preview_handler.py
+++ b/apostrophe/preview_handler.py
@@ -38,9 +38,10 @@ class PreviewHandler:
window.connect("style-updated", self.reload)
- self.text_changed_handler_id = None
-
self.settings = Settings.new()
+ self.settings.connect("changed", self.reload)
+
+ self.text_changed_handler_id = None
self.web_scroll_handler_id = None
self.text_scroll_handler_id = None
diff --git a/apostrophe/text_view.py b/apostrophe/text_view.py
index efaf76441af9970e2af77569c8f19ccb35022878..8270fa9a51deb28cbf4eade7b9e7ab6cde586155 100644
--- a/apostrophe/text_view.py
+++ b/apostrophe/text_view.py
@@ -11,14 +11,15 @@ from apostrophe.text_view_undo_redo_handler import UndoRedoHandler
gi.require_version('Gtk', '3.0')
gi.require_version('Gspell', '1')
-from gi.repository import Gtk, Gdk, GObject, GLib, Gspell
+gi.require_version('GtkSource', '4')
+from gi.repository import Gtk, Gdk, GObject, GLib, Gspell, GtkSource
import logging
LOGGER = logging.getLogger('apostrophe')
-class TextView(Gtk.TextView):
+class TextView(GtkSource.View):
"""ApostropheTextView encapsulates all the features around the editor.
It combines the following:
@@ -38,8 +39,8 @@ class TextView(Gtk.TextView):
'insert-listitem': (GObject.SignalFlags.ACTION, None, ()),
'insert-header': (GObject.SignalFlags.ACTION, None, ()),
'insert-strikethrough': (GObject.SignalFlags.ACTION, None, ()),
- 'undo': (GObject.SignalFlags.ACTION, None, ()),
- 'redo': (GObject.SignalFlags.ACTION, None, ()),
+ 'undo-it': (GObject.SignalFlags.ACTION, None, ()),
+ 'redo-it': (GObject.SignalFlags.ACTION, None, ()),
'scroll-scale-changed': (GObject.SIGNAL_RUN_LAST, None, (float,)),
}
@@ -60,7 +61,7 @@ class TextView(Gtk.TextView):
# when Handy.Window is implemented
# self.set_margin_left(8)
- self.set_margin_right(8)
+ # self.set_margin_right(8)
# Text sizing
self.props.halign = Gtk.Align.FILL
@@ -80,16 +81,12 @@ class TextView(Gtk.TextView):
# Undo / redo
self.undo_redo = UndoRedoHandler()
- self.get_buffer().connect('begin-user-action',
- self.undo_redo.on_begin_user_action)
- self.get_buffer().connect('end-user-action',
- self.undo_redo.on_end_user_action)
- self.get_buffer().connect('insert-text',
- self.undo_redo.on_insert_text)
- self.get_buffer().connect('delete-range',
- self.undo_redo.on_delete_range)
- self.connect('undo', self.undo_redo.undo)
- self.connect('redo', self.undo_redo.redo)
+ self.get_buffer().connect('begin-user-action', self.undo_redo.on_begin_user_action)
+ self.get_buffer().connect('end-user-action', self.undo_redo.on_end_user_action)
+ self.get_buffer().connect('insert-text', self.undo_redo.on_insert_text)
+ self.get_buffer().connect('delete-range', self.undo_redo.on_delete_range)
+ self.connect('undo-it', self.undo_redo.undo)
+ self.connect('redo-it', self.undo_redo.redo)
# Format shortcuts
self.shortcut = FormatInserter()
@@ -243,7 +240,8 @@ class TextView(Gtk.TextView):
line_width = (self.line_chars + 1) *\
int(self.get_char_width(self.font_size)) - 1
horizontal_margin = (width - line_width) / 2
- self.props.left_margin = horizontal_margin
+ # This "+ 8" value helps make markup not hug the left side of the window
+ self.props.left_margin = horizontal_margin + 8
self.props.right_margin = horizontal_margin
def update_vertical_margin(self, top_margin=0, hb_size=0):
diff --git a/apostrophe/text_view_markup_handler.py b/apostrophe/text_view_markup_handler.py
index 16df190b48b9dfaa1e913d3b4464c3be2411e934..1051a4afba523cf77b70a086b712fe6702664c6a 100644
--- a/apostrophe/text_view_markup_handler.py
+++ b/apostrophe/text_view_markup_handler.py
@@ -14,21 +14,21 @@
# with this program. If not, see .
# END LICENSE
-from gi.repository import Pango
-from gi.repository import Gtk, GLib
import re
from multiprocessing import Pipe, Process
import gi
from apostrophe import helpers, markup_regex
-from apostrophe.markup_regex import STRIKETHROUGH, BOLD_ITALIC,\
- BOLD, ITALIC_ASTERISK, ITALIC_UNDERSCORE, IMAGE, LINK, LINK_ALT,\
- HORIZONTAL_RULE, LIST, ORDERED_LIST, BLOCK_QUOTE, HEADER, HEADER_UNDER,\
- TABLE, MATH, CODE
+from apostrophe.markup_regex import STRIKETHROUGH, BOLD_ITALIC, BOLD, ITALIC_ASTERISK, ITALIC_UNDERSCORE, IMAGE, LINK,\
+ LINK_ALT, HORIZONTAL_RULE, LIST, ORDERED_LIST, BLOCK_QUOTE, HEADER, HEADER_UNDER, TABLE, MATH, \
+ CODE
+from apostrophe.settings import Settings
gi.require_version('Gtk', '3.0')
-
+gi.require_version('GtkSource', '4')
+from gi.repository import Gtk, GLib, GtkSource
+from gi.repository import Pango
class MarkupHandler:
TAG_NAME_ITALIC = 'italic'
@@ -48,6 +48,7 @@ class MarkupHandler:
self.text_view = text_view
self.text_buffer = text_view.get_buffer()
self.marked_up_text = None
+ self.settings = Settings.new()
# Tags.
buffer = self.text_buffer
@@ -128,6 +129,7 @@ class MarkupHandler:
# Style.
self.on_style_updated()
+ self.settings.connect("changed", self.on_style_updated)
# Worker process to handle parsing.
self.parsing = False
@@ -141,13 +143,45 @@ class MarkupHandler:
self.on_parsed)
def on_style_updated(self, *_):
+ vs = self.settings.get_string("color-scheme")
+ style_manager = GtkSource.StyleSchemeManager.get_default()
+ gtksettings = Gtk.Settings.get_default()
+
style_context = self.text_view.get_style_context()
- (found, color) = style_context.lookup_color('code_bg_color')
- if not found:
- (_, color) = style_context.lookup_color('background_color')
- self.tag_code_text.set_property("background", color.to_string())
- self.tag_code_block.set_property(
- "paragraph-background", color.to_string())
+
+ if vs == "light":
+ style = style_manager.get_scheme("apostrophe")
+ gtksettings.props.gtk_application_prefer_dark_theme = False
+ self.text_buffer.set_style_scheme(style)
+
+ (found, color) = style_context.lookup_color('code_bg_color')
+ if not found:
+ (_, color) = style_context.lookup_color('background_color')
+ self.tag_code_text.set_property("background", color.to_string())
+ self.tag_code_block.set_property(
+ "paragraph-background", color.to_string())
+ elif vs == "sepia":
+ style = style_manager.get_scheme("apostrophe-sepia")
+ gtksettings.props.gtk_application_prefer_dark_theme = False
+ self.text_buffer.set_style_scheme(style)
+
+ (sfound, scolor) = style_context.lookup_color('sepia_code_bg_color')
+ if not sfound:
+ (_, scolor) = style_context.lookup_color('background_color')
+ self.tag_code_text.set_property("background", scolor.to_string())
+ self.tag_code_block.set_property(
+ "paragraph-background", scolor.to_string())
+ elif vs == "dark":
+ style = style_manager.get_scheme("apostrophe-dark")
+ gtksettings.props.gtk_application_prefer_dark_theme = True
+ self.text_buffer.set_style_scheme(style)
+
+ (found, color) = style_context.lookup_color('code_bg_color')
+ if not found:
+ (_, color) = style_context.lookup_color('background_color')
+ self.tag_code_text.set_property("background", color.to_string())
+ self.tag_code_block.set_property(
+ "paragraph-background", color.to_string())
def apply(self):
"""Applies markup, parsing it in a worker process
diff --git a/apostrophe/theme.py b/apostrophe/theme.py
deleted file mode 100644
index 5b90609dcb6f7f4db494b553002cb95d2c4fe802..0000000000000000000000000000000000000000
--- a/apostrophe/theme.py
+++ /dev/null
@@ -1,66 +0,0 @@
-from gi.repository import Gtk
-
-from apostrophe.settings import Settings
-from apostrophe.helpers import get_media_path
-
-
-class Theme:
- """
- The Theme enum lists all supported themes using their "gtk-theme-name" value.
-
- The light variant is listed first, followed by the dark variant, if any.
- """
-
- previous = None
- settings = Settings.new()
-
- def __init__(self, name, web_css_path, is_dark, inverse_name):
- self.name = name
- self.web_css_path = web_css_path
- self.is_dark = is_dark
- self.inverse_name = inverse_name
-
- @classmethod
- def get_for_name(cls, name, default=None):
- current_theme = default or defaultThemes[0]
- for theme in defaultThemes:
- if name == theme.name:
- current_theme = theme
- return current_theme
-
- @classmethod
- def get_current_changed(cls):
- theme_name = Gtk.Settings.get_default().get_property('gtk-theme-name')
- dark_mode = cls.settings.get_boolean('dark-mode')
- current_theme = cls.get_for_name(theme_name)
- if dark_mode != current_theme.is_dark and current_theme.inverse_name:
- current_theme = cls.get_for_name(current_theme.inverse_name, current_theme.name)
- changed = current_theme != cls.previous
- cls.previous = current_theme
- return current_theme, changed
-
- @classmethod
- def get_current(cls):
- current_theme, _ = cls.get_current_changed()
- return current_theme
-
- def __eq__(self, other):
- return isinstance(other, self.__class__) and \
- self.name == other.name and \
- self.web_css_path == other.web_css_path and \
- self.is_dark == other.is_dark and \
- self.inverse_name == other.inverse_name
-
-
-defaultThemes = [
- # https://gitlab.gnome.org/GNOME/gtk/tree/master/gtk/theme/Adwaita
- Theme('Adwaita', get_media_path('/media/css/web/adwaita.css'), False, 'Adwaita-dark'),
- Theme('Adwaita-dark', get_media_path('/media/css/web/adwaita.css'), True, 'Adwaita'),
- # https://github.com/NicoHood/arc-theme/tree/master/common/gtk-3.0/3.20/sass
- Theme('Arc', get_media_path('/media/css/web/arc.css'), False, 'Arc-Dark'),
- Theme('Arc-Darker', get_media_path('/media/css/web/arc.css'), False, 'Arc-Dark'),
- Theme('Arc-Dark', get_media_path('/media/css/web/arc.css'), True, 'Arc'),
- # https://gitlab.gnome.org/GNOME/gtk/tree/master/gtk/theme/HighContrast
- Theme('HighContrast', get_media_path('/media/css/web/highcontrast.css'), False, 'HighContrastInverse'),
- Theme('HighContrastInverse', get_media_path('/media/css/web/highcontrast_inverse.css'), True, 'HighContrast')
-]
diff --git a/data/media/css/gtk/base.css b/data/media/css/gtk/base.css
index 35a034670601969369f75d5f5a886d3ee954f4fb..2bd7c31f8100fa47f5b9a12cd3a277a1b0873fbc 100644
--- a/data/media/css/gtk/base.css
+++ b/data/media/css/gtk/base.css
@@ -10,23 +10,17 @@
bind "r" { "insert-hrule" () };
bind "u" { "insert-listitem" () };
bind "h" { "insert-header" () };
- bind "z" { "undo" () };
- bind "y" { "redo" () };
+ bind "z" { "undo-it" () };
+ bind "y" { "redo-it" () };
bind "d" { "insert-strikethrough" () };
/*bind "t" { "insert-at-cursor" ('[ ] ') };*/
bind "z" { "redo" () };
}
@define-color code_bg_color mix(@theme_base_color, @theme_fg_color, 0.05);
+@define-color sepia_code_bg_color mix(#eadfd2, #f9f3e9, 0.05);
/* Main window and text colors */
-
-.apostrophe-window {
- background: @theme_base_color;
- color: @theme_fg_color;
- caret-color: @theme_fg_color;
-}
-
.apostrophe-window.focus:not(.tiled):not(.tiled-top):not(.tiled-bottom):not(.tiled-left):not(.tiled-right):not(.maximized):not(.fullscreen) {
border-top-left-radius: 8px;
border-top-right-radius: 8px;
@@ -87,17 +81,6 @@
font-size: 18px;
}
-.apostrophe-editor text {
- background-color: @theme_base_color;
- color: @theme_fg_color;
- caret-color: @theme_fg_color;
-}
-
-.apostrophe-editor text selection {
- background-color: @theme_selected_bg_color;
- color: @theme_selected_fg_color;
-}
-
.apostrophe-editor button {
margin: 0;
padding: 0;
@@ -200,7 +183,7 @@
.color-light {
background: #ffffff;
- box-shadow: inset 0 0 0 1px #2e3436;
+ box-shadow: inset 0 0 0 1px alpha(black, .15);
}
.color-light:checked {
@@ -208,9 +191,18 @@
box-shadow: inset 0 0 0 2px @theme_selected_bg_color;
}
+.color-sepia {
+ background: #F0E8DD;
+ box-shadow: inset 0 0 0 1px alpha(black, .15);
+}
+.color-sepia:checked {
+ color: #3b3228;
+ box-shadow: inset 0 0 0 2px @theme_selected_bg_color;
+}
+
.color-dark {
background: #2d2d2d;
- box-shadow: inset 0 0 0 1px alpha(black, .35);
+ box-shadow: inset 0 0 0 1px alpha(black, .15);
}
.color-dark:checked {
color: #eeeeec;
@@ -220,4 +212,13 @@
.color-button:disabled {
background: #929292;
box-shadow: inset 0 0 0 1px #2e3436;
-}
\ No newline at end of file
+}
+
+.apostrophe-stats-button-sepia {
+ background-color: #f9f3e9;
+}
+
+.apostrophe-stats-button-sepia:hover,
+.apostrophe-stats-button-sepia:active {
+ background-color: #e9e3d9;
+}
diff --git a/data/media/css/web/adwaita-dark.css b/data/media/css/web/adwaita-dark.css
new file mode 100644
index 0000000000000000000000000000000000000000..b22072d165bd11e7016dd7490cadec4a5a708507
--- /dev/null
+++ b/data/media/css/web/adwaita-dark.css
@@ -0,0 +1,18 @@
+@import url("base.css");
+
+:root {
+ --text-color: #ffffff;
+ --background-color: #353535;
+ --alt-background-color: #3a3a3a;
+ --link-color: #b5daff;
+ --blockquote-text-color: #a8a8a6;
+ --blockquote-border-color: #525252;
+ --header-border-color: #474747;
+ --hr-background-color: #505050;
+ --table-tr-border-color: #696969;
+ --table-td-border-color: #525252;
+ --kbd-text-color: #cececc;
+ --kbd-background-color: #3c3c3c;
+ --kbd-border-color: #696969;
+ --kbd-shadow-color: #979797;
+}
diff --git a/data/media/css/web/adwaita-sepia.css b/data/media/css/web/adwaita-sepia.css
new file mode 100644
index 0000000000000000000000000000000000000000..c6dbb12fed5e76cbb0422e236888b373dc3b275d
--- /dev/null
+++ b/data/media/css/web/adwaita-sepia.css
@@ -0,0 +1,18 @@
+@import url("base.css");
+
+:root {
+ --text-color: #5e3d25;
+ --background-color: #f2ebe0;
+ --alt-background-color: #eadfd2;
+ --link-color: #00897b;
+ --blockquote-text-color: #5e3d25;
+ --blockquote-border-color: #dacfc2;
+ --header-border-color: #927966;
+ --hr-background-color: #927966;
+ --table-tr-border-color: #dacfc2;
+ --table-td-border-color: #dacfc2;
+ --kbd-text-color: #5e3d25;
+ --kbd-background-color: #dacfc2;
+ --kbd-border-color: #eadfd2;
+ --kbd-shadow-color: #d8c4a7;
+}
diff --git a/data/media/css/web/adwaita.css b/data/media/css/web/adwaita.css
index f37b57ef4e1538a29ac37a432ef401d49150dd62..0efb7ade924aa9aa85f6515e3dee97c01efecb8f 100644
--- a/data/media/css/web/adwaita.css
+++ b/data/media/css/web/adwaita.css
@@ -16,22 +16,3 @@
--kbd-border-color: #bdc1c6;
--kbd-shadow-color: #8c939a;
}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --text-color: #eeeeec;
- --background-color: #353535;
- --alt-background-color: #3a3a3a;
- --link-color: #b5daff;
- --blockquote-text-color: #a8a8a6;
- --blockquote-border-color: #525252;
- --header-border-color: #474747;
- --hr-background-color: #505050;
- --table-tr-border-color: #696969;
- --table-td-border-color: #525252;
- --kbd-text-color: #cececc;
- --kbd-background-color: #3c3c3c;
- --kbd-border-color: #696969;
- --kbd-shadow-color: #979797;
- }
-}
diff --git a/data/media/css/web/arc.css b/data/media/css/web/arc.css
deleted file mode 100644
index ea0d3c4b90d8ead29fcadc1d94cc5d038e8e95b2..0000000000000000000000000000000000000000
--- a/data/media/css/web/arc.css
+++ /dev/null
@@ -1,37 +0,0 @@
-@import url("base.css");
-
-:root {
- --text-color: #3b3e45;
- --background-color: #f5f6f7;
- --alt-background-color: #eceff2;
- --link-color: #1a7bed;
- --blockquote-text-color: #818894;
- --blockquote-border-color: #d5d9dd;
- --header-border-color: #e0e3e7;
- --hr-background-color: #d7dbe0;
- --table-tr-border-color: #bcc2c9;
- --table-td-border-color: #d5d9dd;
- --kbd-text-color: #5b626d;
- --kbd-background-color: #f0f2f4;
- --kbd-border-color: #bcc2c9;
- --kbd-shadow-color: #8b949d;
-}
-
-@media (prefers-color-scheme: dark) {
- :root {
- --text-color: #d3dae3;
- --background-color: #383c4a;
- --alt-background-color: #3d414f;
- --link-color: #9ac6ff;
- --blockquote-text-color: #8d949d;
- --blockquote-border-color: #555967;
- --header-border-color: #4a4e5c;
- --hr-background-color: #535765;
- --table-tr-border-color: #6c707e;
- --table-td-border-color: #555967;
- --kbd-text-color: #b3bac3;
- --kbd-background-color: #3f4351;
- --kbd-border-color: #6c707e;
- --kbd-shadow-color: #9a9eac;
- }
-}
diff --git a/data/media/css/web/highcontrast.css b/data/media/css/web/highcontrast.css
index 3a33d1faade900170858b636b946e3650a96024f..03fe3a69174e15008d2c603adc72dad479bb6a9a 100644
--- a/data/media/css/web/highcontrast.css
+++ b/data/media/css/web/highcontrast.css
@@ -23,4 +23,4 @@ pre {
--kbd-background-color: #ffffff;
--kbd-border-color: #000000;
--kbd-shadow-color: #000000;
-}
\ No newline at end of file
+}
diff --git a/data/media/css/web/highcontrast_inverse.css b/data/media/css/web/highcontrastinverse.css
similarity index 99%
rename from data/media/css/web/highcontrast_inverse.css
rename to data/media/css/web/highcontrastinverse.css
index 3e5ac252340ccacfc79fdf9d75ca09523fb6c497..9703ffa720d0dea85dc0e9f59adc93299b377527 100644
--- a/data/media/css/web/highcontrast_inverse.css
+++ b/data/media/css/web/highcontrastinverse.css
@@ -23,4 +23,4 @@ pre {
--kbd-background-color: #000000;
--kbd-border-color: #ffffff;
--kbd-shadow-color: #ffffff;
-}
\ No newline at end of file
+}
diff --git a/data/meson.build b/data/meson.build
index 8c9dcd05c45738a7f074d652a6eb2a5211c586db..6f6766402d3540806d99931abb63a6c9eaf3272f 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -115,3 +115,18 @@ install_subdir(
'reference_files',
install_dir: pkgdatadir
)
+
+install_data(
+ join_paths('schemes', 'apostrophe.xml'),
+ install_dir: join_paths(get_option('datadir'), 'gtksourceview-4', 'styles')
+)
+
+install_data(
+ join_paths('schemes', 'apostrophe-sepia.xml'),
+ install_dir: join_paths(get_option('datadir'), 'gtksourceview-4', 'styles')
+)
+
+install_data(
+ join_paths('schemes', 'apostrophe-dark.xml'),
+ install_dir: join_paths(get_option('datadir'), 'gtksourceview-4', 'styles')
+)
diff --git a/data/org.gnome.gitlab.somas.Apostrophe.gschema.xml b/data/org.gnome.gitlab.somas.Apostrophe.gschema.xml
index 1798ffe579eaf125eef2d1a284046b12c1413b68..3a774f29826ed969dddecd1b117ead6a1d19d832 100644
--- a/data/org.gnome.gitlab.somas.Apostrophe.gschema.xml
+++ b/data/org.gnome.gitlab.somas.Apostrophe.gschema.xml
@@ -18,11 +18,11 @@
-
- false
- Use dark mode
+
+ "light"
+ The color scheme of the UI
- Enable or disable the dark mode.
+ The scheme to color the interface with. (light/sepia/dark, default is light.)
diff --git a/data/schemes/apostrophe-dark.xml b/data/schemes/apostrophe-dark.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8a95b84f2a4adb8bfe6bbae40371cb1cc7d34fa5
--- /dev/null
+++ b/data/schemes/apostrophe-dark.xml
@@ -0,0 +1,9 @@
+
+
+ Lains
+ <_description>Emphasis on focus.
+
+
+
+
+
diff --git a/data/schemes/apostrophe-sepia.xml b/data/schemes/apostrophe-sepia.xml
new file mode 100644
index 0000000000000000000000000000000000000000..67c64b46f9e78bb6b87f2344c10183d0a745db2c
--- /dev/null
+++ b/data/schemes/apostrophe-sepia.xml
@@ -0,0 +1,9 @@
+
+
+ Lains
+ <_description>Emphasis on focus.
+
+
+
+
+
diff --git a/data/schemes/apostrophe.xml b/data/schemes/apostrophe.xml
new file mode 100644
index 0000000000000000000000000000000000000000..c85f965365d8466bc685b899bf2916bb8a5a0269
--- /dev/null
+++ b/data/schemes/apostrophe.xml
@@ -0,0 +1,9 @@
+
+
+ Lains
+ <_description>Emphasis on focus.
+
+
+
+
+
diff --git a/data/ui/Menu.ui b/data/ui/Menu.ui
index 7ad7ebf481f61cc69458b0837fae3d45b01c5007..06242e954bd9c4e568af8802bb9144e62a526be1 100644
--- a/data/ui/Menu.ui
+++ b/data/ui/Menu.ui
@@ -47,6 +47,32 @@
0
+
+
+
+ False
+ True
+ 1
+
+
True
@@ -70,7 +96,7 @@
False
True
- 1
+ 2
diff --git a/data/ui/Window.ui b/data/ui/Window.ui
index 7cf9aa67779620666996a282caab1c40b6997173..319bcc309a68e81abfea2b5bc2cb8cebb7e2e7e6 100644
--- a/data/ui/Window.ui
+++ b/data/ui/Window.ui
@@ -77,7 +77,6 @@
True
True
True
- 8
True
True