From 0a78ecbd0b434fbd58b0ea0693682cb4c5fda90d Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:45:58 +0100 Subject: [PATCH] Merge pull request #27138 from overleaf/dp-overleaf-dark Add overleaf dark editor theme GitOrigin-RevId: bd8cdbcc7ad6b56078611b7c2ab69008ea578ae7 --- .../src/Features/Project/ProjectController.js | 1 + .../themes/cm6/dracula-license.txt | 28 +------ .../themes/cm6/overleaf_dark-license.txt | 16 ++++ .../themes/cm6/overleaf_dark.json | 75 +++++++++++++++++++ .../themes/scripts/overrides.json | 12 +++ 5 files changed, 108 insertions(+), 24 deletions(-) create mode 100644 services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark-license.txt create mode 100644 services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark.json diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 3570834e04..6de47892bc 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -1164,6 +1164,7 @@ const THEME_LIST = [ 'eclipse', 'monokai', 'overleaf', + 'overleaf_dark', 'textmate', ] diff --git a/services/web/frontend/js/features/source-editor/themes/cm6/dracula-license.txt b/services/web/frontend/js/features/source-editor/themes/cm6/dracula-license.txt index d70d8cae37..fbeb04a425 100644 --- a/services/web/frontend/js/features/source-editor/themes/cm6/dracula-license.txt +++ b/services/web/frontend/js/features/source-editor/themes/cm6/dracula-license.txt @@ -5,31 +5,11 @@ Source: https://github.com/ajaxorg/ace/ The theme's original license is copied below: ***** BEGIN LICENSE BLOCK ***** -Distributed under the BSD license: +Copyright © 2017 Zeno Rocha -Copyright (c) 2010, Ajax.org B.V. -All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of Ajax.org B.V. nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ***** END LICENSE BLOCK ***** \ No newline at end of file diff --git a/services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark-license.txt b/services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark-license.txt new file mode 100644 index 0000000000..2c74f30ab5 --- /dev/null +++ b/services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark-license.txt @@ -0,0 +1,16 @@ +Derived from the Dracula theme for the Ace editor, with the background colour changed. +Conversion by Overleaf from Ace to CodeMirror 6. + +Source: https://github.com/ajaxorg/ace/ + +The theme's original license is copied below: + +***** BEGIN LICENSE BLOCK ***** +Copyright © 2017 Zeno Rocha + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +***** END LICENSE BLOCK ***** \ No newline at end of file diff --git a/services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark.json b/services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark.json new file mode 100644 index 0000000000..1fba763622 --- /dev/null +++ b/services/web/frontend/js/features/source-editor/themes/cm6/overleaf_dark.json @@ -0,0 +1,75 @@ +{ + "theme": { + ".cm-gutters": { + "backgroundColor": "transparent", + "borderRightColor": "transparent", + "background": "#1b222c", + "color": "rgb(144,145,148)" + }, + "&": { + "backgroundColor": "#1b222c", + "color": "#f8f8f2" + }, + ".cm-cursor, .cm-dropCursor": { + "color": "#f8f8f0" + }, + "&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection, .cm-searchMatch.cm-searchMatch.cm-searchMatch-selected": { + "background": "#44475a" + }, + "&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": { + "margin": 0, + "outline": "1px solid #a29709" + }, + ".cm-activeLine": { + "background": "#44475a" + }, + ".cm-activeLineGutter": { + "backgroundColor": "#44475a" + }, + ".cm-selectionMatch.cm-selectionMatch, .cm-searchMatch.cm-searchMatch": { + "boxShadow": "0px 0px 0px 1px inset #a29709", + "borderRadius": "3px", + "margin": 0 + }, + ".cm-foldPlaceholder": { + "backgroundColor": "#50fa7b", + "borderColor": "#f8f8f2" + } + }, + "highlightStyle": { + ".tok-keyword": { + "color": "#ff79c6" + }, + ".tok-literal": { + "color": "#ff79c6" + }, + ".tok-typeName": { + "color": "#8be9fd", + "fontStyle": "italic" + }, + ".tok-invalid": { + "color": "#F8F8F0", + "backgroundColor": "#ff79c6" + }, + ".tok-string": { + "color": "#f1fa8c" + }, + ".tok-comment": { + "color": "#6272a4" + }, + ".tok-attributeValue": { + "color": "#ffb86c", + "fontStyle": "italic" + }, + ".tok-attributeName": { + "color": "#50fa7b" + }, + ".tok-function": { + "color": "#50fa7b" + }, + ".tok-tagName": { + "color": "#ff79c6" + } + }, + "dark": true +} diff --git a/services/web/frontend/js/features/source-editor/themes/scripts/overrides.json b/services/web/frontend/js/features/source-editor/themes/scripts/overrides.json index 2e03ba3ece..62147ce3f0 100644 --- a/services/web/frontend/js/features/source-editor/themes/scripts/overrides.json +++ b/services/web/frontend/js/features/source-editor/themes/scripts/overrides.json @@ -61,6 +61,18 @@ } } }, + "overleaf-dark": { + "highlightStyle": { + ".tok-literal": { + "color": "#ff79c6" + } + }, + "theme": { + ".cm-selectionMatch.cm-selectionMatch, .cm-searchMatch.cm-searchMatch": { + "boxShadow": "0px 0px 0px 1px inset #a29709" + } + } + }, "gruvbox": { "theme": { ".cm-selectionMatch.cm-selectionMatch, .cm-searchMatch.cm-searchMatch": {