Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected "arc" -> "src"

...

  1. Choose a theme to start from:  As documented above, there are two "src/theme/" directories provided out of the box: "custom" or "dspace".  You should select one to use as the basis for your theme.  Which you choose is up to you, but here are a few things to consider:
    1. DSpace Theme (src/themes/dspace): This is a simple, example theme for novice users.  Primarily, in this theme, you can immediately customize the CSS, header & homepage components. You can add other components as needed (see "Adding Component Directories to your Theme" below).
      1. Advantages: This theme is small and simple. It provides an easy starting point / example for basic themes.  Future User Interface upgrades (e.g. from 7.1 → 7.2) are likely to be easier because the theme is smaller in size.
      2. Disadvantages: It has very few component directories by default. But you can always add more.  See "Adding Component Directories to your Theme" below.
    2. Custom Theme (src/themes/custom): This theme provides all available theme-able components for more advanced or complex theming options. This provides you full control over everything that is theme-able in the User Interface
      1. Advantages: All theme-able components are provided in subdirectories. This makes it easier to modify the look and feel of any area of the User Interface.
      2. Disadvantages: After creating your theme, you may wish to remove any component directories that you didn't modify (see "Removing Component Directories from your Theme" below).  Generally speaking, upgrades (e.g. from 7.1 → 7.2) are often easier if your theme includes fewer components (as your theme may require updates if any component it references change significantly).
  2. Create your own theme folder OR edit the existing theme folder: Either edit the theme directory in place, or copy it (and all its contents) into a new folder under src/themes/ (choose whatever folder name you want)
  3. Register your theme folder (only necessary if you create a new folder in previous step): Now, we need to make the UI aware of this new theme folder, before it can be used in configuration.
    1. Modify angular.json (in the root folder), adding your theme folder's main "theme.scss" file to the "styles" list.  The below example is for a new theme folder named src/themes/mydspacesite/

      Code Block
      "styles": [
        "src/styles/startup.scss",
        {
           "input": "src/styles/base-theme.scss",
           "inject": false,
           "bundleName": "base-theme"
        },
        ...
        {
           "input": "src/themes/mydspacesite/styles/theme.scss",
           "inject": false,
           "bundleName": "mydspacesite-theme"
        },
      ]

      NOTE: the "bundleName" for your custom them MUST use the format "${folder-name}-theme".  E.g. if the folder is named "arcsrc/themes/amazingtheme", then the "bundleName" MUST be "amazingtheme-theme"

  4. Enable your theme: Modify your config/config.*.yml configuration file (in 7.1 or 7.0 this file was named src/environments/environment.*.ts), adding your new theme to the "themes" array in that file.  Pay close attention to modify the correct configuration file (e.g. modify config.dev.yml if running in dev mode, or config.prod.yml if running in prod mode).  We recommend starting in "dev mode" (config.dev.yml) as this mode lets you see your changes immediately in a browser without a full rebuild of the UI – see next step. 

    Code Block
    languageyml
    titleFormat for 7.2 or above (config.*.yml)
    # In this example, we only show one theme enabled. It's possible to enable multiple (see below note)
    themes: 
      - name: 'mydspacesite'



    Code Block
    titleFormat for 7.1 or 7.0 (environment.*.ts)
    // In this example, we only show one theme enabled. It's possible to enable multiple (see below note)
    themes: [
     {
        name: 'mydspacesite'
     },
    ]


    NOTE: The "name" used is the name of the theme's folder, so the example is for enabling a theme at src/themes/mydspacesite/ globally.  You should also comment out the default "dspace" theme, if you intend to replace it entirely.
    NOTE #2: You may also choose to enable multiple themes for your site, and even specify a different theme for different Communities, Collections, Items or URL paths. See User Interface Configuration for more details on "Theme Settings"
  5. Verify your settings by starting the UI (ideally in Dev mode): At this point, you should verify the basic settings you've made all "work".  We recommend doing your theme work while running the UI in "dev mode", as the UI will auto-restart anytime you save a new change.  This will allow you to quickly see the impact of each change in your browser. 

    Code Block
    # Start in dev mode (which uses config.dev.yml)
    yarn start:dev


  6. At this point, you can start making changes to your theme.  See the following sections for examples of how to make common changes.

...