Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to load customized css #5790

Closed
thanever opened this issue Dec 28, 2019 · 8 comments · Fixed by #6725
Closed

Allow to load customized css #5790

thanever opened this issue Dec 28, 2019 · 8 comments · Fixed by #6725
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty. type: documentation ui

Comments

@thanever
Copy link

Would reducing the height of the part shown in the figure below make appearance more coordinated?

Capture

@tobiasdiez
Copy link
Member

Thanks for your suggestion. What do you mean in detail: reduce the size of the icons, or remove them completely?

@thanever
Copy link
Author

Sorry for the confusion. What I mean is to reduce the height as shown in the figure below.

ccc

A comparison with the height of Google Chrome. Thanks for your work.

Capture1

@urielz
Copy link

urielz commented Jan 4, 2020

small detail but I agree with @thanever

@koppor
Copy link
Member

koppor commented Jan 31, 2020

Decision:

  • Offer editing of CSS
  • Offer importing / exporting of CSS

We will tag as good first issue for newcomers and hope for contributions.

@koppor koppor added the good first issue An issue intended for project-newcomers. Varies in difficulty. label Jan 31, 2020
@tobiasdiez tobiasdiez changed the title Appearance improvement Allow to load customized css Jan 31, 2020
@tobiasdiez
Copy link
Member

In a bit more detail, the following needs to be done:

  • Add a possibility to specify a custom css file in the preference dialog.
    <RadioButton fx:id="themeLight" text="%Light theme" toggleGroup="$theme"/>
    <RadioButton fx:id="themeDark" text="%Dark theme" toggleGroup="$theme"/>
  • The following code needs to be slightly modified to allow loading of external css files:
    // Otherwise load css from preference
    URL cssResource = JabRefFrame.class.getResource(cssPreferences);
    if (cssResource != null) {
    LOGGER.debug("Using css " + cssResource);
    additionalCssToLoad = Optional.of(cssResource);
    } else {
    additionalCssToLoad = Optional.empty();
    LOGGER.warn("Cannot load css " + cssPreferences);
    }

As a workaround, it is already possible to specify the css as a command line argument as described here:

* Installs the style file and provides live reloading.
* <p>
* The live reloading has to be turned on by setting the <code>-Djabref.theme.css</code> property.
* There two possible modes:
* (1) When only <code>-Djabref.theme.css</code> is specified, then the standard <code>Base.css</code> that is found will be watched
* and on changes in that file, the style-sheet will be reloaded and changes are immediately visible.
* (2) When a path to a css file is passed to <code>-Djabref.theme.css</code>, then the given style is loaded in addition to the base css file.
* Changes in the specified css file lead to an immediate redraw of the interface.
* <p>
* When working from an IDE, this usually means that the <code>Base.css</code> is located in the build folder.
* To use the css-file that is located in the sources directly, the full path can be given as value for the "VM option":
* <code>-Djabref.theme.css="/path/to/src/Base.css"</code>

This method should be properly documented by adding it with a bit more details to http://devdocs.jabref.org.

@nilsstre
Copy link
Contributor

Hey, I would like to try to solve this issue 😃

nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 26, 2020
* Add CSS file type, add button in preferences to import a custom CSS file, started on import functionality

* Change so that the log uses format specifiers instead of string concatenation

* Add RadioButton for toggling custom theme

* Add preference for setting the path to custom CSS theme

* Load custom CSS if toggled

* Add missing language keys

* Remove check if the current theme is applied again, the check is removed since we don't need it

* Save path to the custom CSS file in program preferences
nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 27, 2020
* Add method for saving theme to file

* Add modal for selection witch theme to export as CSS
@nilsstre
Copy link
Contributor

I have implemented the requested feature and created a pull request #6036

nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 27, 2020
nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 27, 2020
nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 27, 2020
nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 27, 2020
nilsstre added a commit to DD2480-Group-22/jabref that referenced this issue Feb 27, 2020
@koppor
Copy link
Member

koppor commented Mar 9, 2020

Thank you for submitting a PR. While seeing the solution, we improved our specification. Maybe, you can work on finalizing the PR?

@calixtus calixtus mentioned this issue Aug 12, 2020
5 tasks
Siedlerchr added a commit that referenced this issue Aug 31, 2020
* feat/#1 Add CSS file type, add button in preferences to import custom CSS file, started on import functionality

* feat/#1 Change so that the log messages uses format specifiers instead of string concatenation

* feat/#1 Add RadioButton for toggling custom theme

* feat/#1 Add preference for setting path to custom CSS theme

* feat/#1 Load custom CSS if toggled

* feat/#1 Add missing language keys

* feat/#1 Remove check if current theme is applied again, check is remove since we don't need it

* feat/#1 Save path to custom CSS file in program preferences

* Add functionality to let the user import custom CSS file #5790

* Add CSS file type, add button in preferences to import a custom CSS file, started on import functionality

* Change so that the log uses format specifiers instead of string concatenation

* Add RadioButton for toggling custom theme

* Add preference for setting the path to custom CSS theme

* Load custom CSS if toggled

* Add missing language keys

* Remove check if the current theme is applied again, the check is removed since we don't need it

* Save path to the custom CSS file in program preferences

* fix/#5 Add checks so that the theme change notification is only shown once, disable custom theme radio button i no custom theme has been imported

* Remove added stuff from merge conflict

* Add export current theme #5790

* Add method for saving theme to file

* Add modal for selection witch theme to export as CSS

* Add missing language lines

* Add information about import/export of themes, #5790

* Fix CodaCy and checkstyle issues, #5790

* Add fixes from code review, #5790

* Remove unused import #5790

* Move the import/export buttons to the Appearance tab #5790

* Fixed merge errors

* Fixed easy remarks

* Introduced AppereancePreferences and changed some visual elements

* Refactored ExportThemeDialog

* Fixed merge error

* Removed export theme logic and added validation

* CHANGELOG.md

* Removed obsolete viewmodel class

* Refactored io.File to nio.Path, use of JabRefPreferences and removed vmOption

* Refactored ThemeLoader object class to enum with static util methods

* Fixed overlooked merge error

* Refactored static methods to object methods

* Checkstyle

Co-authored-by: Nils Streijffert <nils.streijffert@gmail.com>
Co-authored-by: Christoph <siedlerkiller@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty. type: documentation ui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants