DEV: Show warning in admin UI for core SCSS color vars (PR #12984)

This is just a visual warning to direct theme maintainers towards CSS custom properties for colors. It’s a small step today that will enable us to eventually compile theme stylesheets independently of color schemes in the future.

GitHub

You already check !this._editor for early exit.

    let warnings = this.content
      .split("\n")
      .map((line, row) => {
        if (line.match(COLOR_VARS_REGEX)) {
          return {
            row,
            column: 0,
            text: I18n.t("admin.customize.theme.scss_warning_inline"),
            type: "warning",
          };
        }
      })
      .filter(Boolean);

    this._editor.getSession().setAnnotations(warnings);

    this.setWarning(
      warnings.length
        ? I18n.t("admin.customize.theme.scss_color_variables_warning")
        : false
    );

The title of this pull request changed from “DEV: Show warning for core SCSS color vars used in admin UI” to "DEV: Show warning in admin UI for core SCSS color vars