styling suggestion

Issue #15 on hold
Peter Gee created an issue

Hey, thanks for this great course format.
Our styling requires we overload the tile border top. There about 6 preset colours, but we prefer to use our own.

In my moodle theme scss i can write:

.format-tiles {
  .course-content {
    ul.tiles {
      .tile {
        border-top-color: $accent-blue;
        background-color: lighten($accent-blue, 70%);

        &:hover {
          border-top-color: $accent-dark-red;
        }
      }

      .tile_bar {
        border-top-color: $accent-blue;

        &:hover {
          border-top-color: $accent-dark-red;
        }
      }
    }
  }
}

but the issue is that the styling is not honoured unless border-top-color is set to $accent-blue !important, because there is inline styling css in the page that overrides the moodle theme styling that is written out in the <head> of the document.

I can see why the issue has arisen - you want to have dynamic colour changes that are set in user settings, but it is kind of anti-pattern for moodle to write out in-line css when it has this css compilation and minification engine inbuilt.

is it possible for you to inject this styling into the moodle themes, and the use colour-themes as classes?

Comments (3)

  1. David Watson repo owner

    Hi Peter

    It’s a valid comment and I was never a fan of the inline CSS either, for the reasons you outline. Eventually I hope to revisit it. I don't have any immediate plans given other priorities but will keep it on the list.

    One other thing to mention is that the Site Admin can change the preset colours to match their own brand colours from the UI at Site administration > Plugins > Course formats > Tiles format. I suspect you probably knew, but just in case. (That page is a not as obvious as it could be and I plan to improve the documentation in the next few weeks.)

  2. David Watson repo owner

    For the next release I have tidied up the admin settings page to make it clearer how the colours work, and included a reset button so that the admin can reset existing courses after changing the colour palette.

  3. Log in to comment