Class Theme.Builder

java.lang.Object
io.jenkins.plugins.thememanager.Theme.Builder
Enclosing class:
Theme

public static class Theme.Builder extends Object
Builder for creating a theme.
  • Method Details

    • withCssUrl

      public Theme.Builder withCssUrl(String cssUrl)
      A URL to a CSS file, this can be served by Jenkins or remote.

      The URL must be absolute (i.e. not just contain the path)

      It is recommended that you serve the CSS file with Jenkins so that users update the theme by updating the plugin.

      There is a convenience method ThemeManagerFactory.getCssUrl(), which will determine the full url if you follow the convention: $JENKINS_URL/theme-$themeId/theme.css.

      The theme.css suffix can be changed by overriding ThemeManagerFactoryDescriptor.getThemeCssSuffix().

      Parameters:
      cssUrl - url to a CSS file that you want loaded.
      Returns:
      the current builder with a CSS URL added to it.
    • withCssUrls

      public Theme.Builder withCssUrls(List<String> cssUrls)
      Parameters:
      cssUrls - a list of urls to CSS files that you want loaded.
      Returns:
      the current builder with CSS URLs added to it.
    • enableOnBlueOcean

      public Theme.Builder enableOnBlueOcean()
      Enables the theme on BlueOcean
      Returns:
      the current builder with BlueOcean enabled.
    • disableOnBlueOcean

      public Theme.Builder disableOnBlueOcean()
      Disables the theme on BlueOcean
      Returns:
      the current builder with BlueOcean disabled.
    • respectSystemAppearance

      public Theme.Builder respectSystemAppearance()
      Marks the theme as a 'system' respecting theme that will adapt to light and dark system configuration
      Returns:
      the current builder with respect system appearance enabled.
    • withProperty

      public Theme.Builder withProperty(String pluginId, String name, String value)
      Properties are a way a theme author can provide extra information to plugins. e.g. the Prism API plugin can read properties and use a default theme based on this information.
      Parameters:
      pluginId - artifact ID of the plugin the property is associated with
      name - property name this will be namespaced with the artifactId automatically
      value - the property value
      Returns:
      the current builder with the new property
    • withJavascriptUrl

      public Theme.Builder withJavascriptUrl(String javascriptUrl)
      A URL to a JavaScript file, this can be served by Jenkins or remote.

      The URL must be absolute (i.e. not just contain the path)

      It is recommended that you serve the JavaScript file with Jenkins so that users update the theme by updating the plugin.

      There is a convenience method ThemeManagerFactory.getJavaScriptUrl(), which will determine the full url if you follow the convention: $JENKINS_URL/theme-$themeId/theme.js.

      The theme.css suffix can be changed by overriding ThemeManagerFactoryDescriptor.getThemeJsSuffix().

      Parameters:
      javascriptUrl - url to a JavaScript file that you want loaded.
      Returns:
      the current builder with a JavaScript URL added to it.
    • withJavascriptUrls

      public Theme.Builder withJavascriptUrls(List<String> javascriptUrls)
      Parameters:
      javascriptUrls - a list of urls to JavaScript files that you want loaded.
      Returns:
      the current builder with JavaScript URLs added to it.
    • build

      public Theme build()
      Constructs the theme
      Returns:
      the theme.