What UIKit Object controls “Look Up" popup appearance?











up vote
3
down vote

favorite












In our app, we have a light mode and a dark mode that switch the text colors and background colors. Theme is an enum with cases light and dark. We have methods for switching the colors, such as:



var textColor: UIColor {
switch self {
case .light:
return UIColor(red:60/255.0, green:60/255.0, blue:60/255.0, alpha: 1.0)
case .dark:
return UIColor(red: 240.0/255.0, green: 248.0/255.0, blue: 255.0/255.0, alpha: 1.0)
}
}


And we have an apply method that applies the Theme to all of the views we use in our app:



func apply(){
defaults.set(rawValue, forKey: "selectedTheme")

UIApplication.shared.delegate?.window??.tintColor = tintColor

let navBarAppearance = UINavigationBar.appearance()
navBarAppearance.barStyle = barStyle
navBarAppearance.backgroundColor = backgroundColor
navBarAppearance.barTintColor = backgroundColor
navBarAppearance.tintColor = tintColor
navBarAppearance.isTranslucent = false
navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: textColor]
let tabBarAppearance = UITabBar.appearance()
tabBarAppearance.barStyle = barStyle
tabBarAppearance.backgroundColor = backgroundColor
tabBarAppearance.barTintColor = backgroundColor

let toolBar = UIToolbar.appearance()
toolBar.backgroundColor = backgroundColor
toolBar.tintColor = backgroundColor
toolBar.barStyle = barStyle
toolBar.isTranslucent = false
toolBar.barTintColor = backgroundColor

UITableViewCell.appearance().backgroundColor = backgroundColor
UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = textColor
UILabel.appearance().textColor = textColor

UITextField.appearance().keyboardAppearance = keyboardColor
UITextField.appearance().textColor = textColor
UITextField.appearance().backgroundColor = backgroundColor

UITextView.appearance().textColor = textColor
UITextView.appearance().backgroundColor = backgroundColor

MultiSelectSegmentedControl.appearance().tintColor = tintColor
MultiSelectSegmentedControl.appearance().backgroundColor = backgroundColor

UISegmentedControl.appearance().tintColor = tintColor
UISegmentedControl.appearance().backgroundColor = backgroundColor

UIButton.appearance().tintColor = tintColor

BigButton.appearance().backgroundColor = Theme.current.tintColor
BigButton.appearance().tintColor = Theme.current.backgroundColor

UIPickerView.appearance().backgroundColor = Theme.current.backgroundColor
UIPickerView.appearance().tintColor = Theme.current.tintColor

UITableView.appearance().backgroundColor = backgroundColor
UITableView.appearance().separatorColor = cellSelectionColor

UISearchBar.appearance().backgroundColor = backgroundColor
UISearchBar.appearance().barTintColor = tintColor
UISearchBar.appearance().searchBarStyle = .minimal
UITextView.appearance().backgroundColor = backgroundColor
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).textColor = textColor

UISwitch.appearance().onTintColor = tintColor

let colorView = UIView()
colorView.backgroundColor = cellSelectionColor

UITableViewCell.appearance().selectedBackgroundView = colorView
}


When one selects text in our app and presses the "look up" button in the popup menu item, the popup that appears looks right. However, when you click on some of the views (such as dictionary and siri knowledge), the background or text colors appear to have been changed. Example:



Darkened Text



How can we control the text color on this popup?



EDIT: The goal is to find the name of the UI Object that is created when the UIMenuItems are pressed. It’s not in the XCode Debugger Inspector, nor is it in self.view.subviews. It seems to be some kind of built-in object that is hidden from the rest of the processes.










share|improve this question




























    up vote
    3
    down vote

    favorite












    In our app, we have a light mode and a dark mode that switch the text colors and background colors. Theme is an enum with cases light and dark. We have methods for switching the colors, such as:



    var textColor: UIColor {
    switch self {
    case .light:
    return UIColor(red:60/255.0, green:60/255.0, blue:60/255.0, alpha: 1.0)
    case .dark:
    return UIColor(red: 240.0/255.0, green: 248.0/255.0, blue: 255.0/255.0, alpha: 1.0)
    }
    }


    And we have an apply method that applies the Theme to all of the views we use in our app:



    func apply(){
    defaults.set(rawValue, forKey: "selectedTheme")

    UIApplication.shared.delegate?.window??.tintColor = tintColor

    let navBarAppearance = UINavigationBar.appearance()
    navBarAppearance.barStyle = barStyle
    navBarAppearance.backgroundColor = backgroundColor
    navBarAppearance.barTintColor = backgroundColor
    navBarAppearance.tintColor = tintColor
    navBarAppearance.isTranslucent = false
    navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: textColor]
    let tabBarAppearance = UITabBar.appearance()
    tabBarAppearance.barStyle = barStyle
    tabBarAppearance.backgroundColor = backgroundColor
    tabBarAppearance.barTintColor = backgroundColor

    let toolBar = UIToolbar.appearance()
    toolBar.backgroundColor = backgroundColor
    toolBar.tintColor = backgroundColor
    toolBar.barStyle = barStyle
    toolBar.isTranslucent = false
    toolBar.barTintColor = backgroundColor

    UITableViewCell.appearance().backgroundColor = backgroundColor
    UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = textColor
    UILabel.appearance().textColor = textColor

    UITextField.appearance().keyboardAppearance = keyboardColor
    UITextField.appearance().textColor = textColor
    UITextField.appearance().backgroundColor = backgroundColor

    UITextView.appearance().textColor = textColor
    UITextView.appearance().backgroundColor = backgroundColor

    MultiSelectSegmentedControl.appearance().tintColor = tintColor
    MultiSelectSegmentedControl.appearance().backgroundColor = backgroundColor

    UISegmentedControl.appearance().tintColor = tintColor
    UISegmentedControl.appearance().backgroundColor = backgroundColor

    UIButton.appearance().tintColor = tintColor

    BigButton.appearance().backgroundColor = Theme.current.tintColor
    BigButton.appearance().tintColor = Theme.current.backgroundColor

    UIPickerView.appearance().backgroundColor = Theme.current.backgroundColor
    UIPickerView.appearance().tintColor = Theme.current.tintColor

    UITableView.appearance().backgroundColor = backgroundColor
    UITableView.appearance().separatorColor = cellSelectionColor

    UISearchBar.appearance().backgroundColor = backgroundColor
    UISearchBar.appearance().barTintColor = tintColor
    UISearchBar.appearance().searchBarStyle = .minimal
    UITextView.appearance().backgroundColor = backgroundColor
    UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).textColor = textColor

    UISwitch.appearance().onTintColor = tintColor

    let colorView = UIView()
    colorView.backgroundColor = cellSelectionColor

    UITableViewCell.appearance().selectedBackgroundView = colorView
    }


    When one selects text in our app and presses the "look up" button in the popup menu item, the popup that appears looks right. However, when you click on some of the views (such as dictionary and siri knowledge), the background or text colors appear to have been changed. Example:



    Darkened Text



    How can we control the text color on this popup?



    EDIT: The goal is to find the name of the UI Object that is created when the UIMenuItems are pressed. It’s not in the XCode Debugger Inspector, nor is it in self.view.subviews. It seems to be some kind of built-in object that is hidden from the rest of the processes.










    share|improve this question


























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      In our app, we have a light mode and a dark mode that switch the text colors and background colors. Theme is an enum with cases light and dark. We have methods for switching the colors, such as:



      var textColor: UIColor {
      switch self {
      case .light:
      return UIColor(red:60/255.0, green:60/255.0, blue:60/255.0, alpha: 1.0)
      case .dark:
      return UIColor(red: 240.0/255.0, green: 248.0/255.0, blue: 255.0/255.0, alpha: 1.0)
      }
      }


      And we have an apply method that applies the Theme to all of the views we use in our app:



      func apply(){
      defaults.set(rawValue, forKey: "selectedTheme")

      UIApplication.shared.delegate?.window??.tintColor = tintColor

      let navBarAppearance = UINavigationBar.appearance()
      navBarAppearance.barStyle = barStyle
      navBarAppearance.backgroundColor = backgroundColor
      navBarAppearance.barTintColor = backgroundColor
      navBarAppearance.tintColor = tintColor
      navBarAppearance.isTranslucent = false
      navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: textColor]
      let tabBarAppearance = UITabBar.appearance()
      tabBarAppearance.barStyle = barStyle
      tabBarAppearance.backgroundColor = backgroundColor
      tabBarAppearance.barTintColor = backgroundColor

      let toolBar = UIToolbar.appearance()
      toolBar.backgroundColor = backgroundColor
      toolBar.tintColor = backgroundColor
      toolBar.barStyle = barStyle
      toolBar.isTranslucent = false
      toolBar.barTintColor = backgroundColor

      UITableViewCell.appearance().backgroundColor = backgroundColor
      UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = textColor
      UILabel.appearance().textColor = textColor

      UITextField.appearance().keyboardAppearance = keyboardColor
      UITextField.appearance().textColor = textColor
      UITextField.appearance().backgroundColor = backgroundColor

      UITextView.appearance().textColor = textColor
      UITextView.appearance().backgroundColor = backgroundColor

      MultiSelectSegmentedControl.appearance().tintColor = tintColor
      MultiSelectSegmentedControl.appearance().backgroundColor = backgroundColor

      UISegmentedControl.appearance().tintColor = tintColor
      UISegmentedControl.appearance().backgroundColor = backgroundColor

      UIButton.appearance().tintColor = tintColor

      BigButton.appearance().backgroundColor = Theme.current.tintColor
      BigButton.appearance().tintColor = Theme.current.backgroundColor

      UIPickerView.appearance().backgroundColor = Theme.current.backgroundColor
      UIPickerView.appearance().tintColor = Theme.current.tintColor

      UITableView.appearance().backgroundColor = backgroundColor
      UITableView.appearance().separatorColor = cellSelectionColor

      UISearchBar.appearance().backgroundColor = backgroundColor
      UISearchBar.appearance().barTintColor = tintColor
      UISearchBar.appearance().searchBarStyle = .minimal
      UITextView.appearance().backgroundColor = backgroundColor
      UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).textColor = textColor

      UISwitch.appearance().onTintColor = tintColor

      let colorView = UIView()
      colorView.backgroundColor = cellSelectionColor

      UITableViewCell.appearance().selectedBackgroundView = colorView
      }


      When one selects text in our app and presses the "look up" button in the popup menu item, the popup that appears looks right. However, when you click on some of the views (such as dictionary and siri knowledge), the background or text colors appear to have been changed. Example:



      Darkened Text



      How can we control the text color on this popup?



      EDIT: The goal is to find the name of the UI Object that is created when the UIMenuItems are pressed. It’s not in the XCode Debugger Inspector, nor is it in self.view.subviews. It seems to be some kind of built-in object that is hidden from the rest of the processes.










      share|improve this question















      In our app, we have a light mode and a dark mode that switch the text colors and background colors. Theme is an enum with cases light and dark. We have methods for switching the colors, such as:



      var textColor: UIColor {
      switch self {
      case .light:
      return UIColor(red:60/255.0, green:60/255.0, blue:60/255.0, alpha: 1.0)
      case .dark:
      return UIColor(red: 240.0/255.0, green: 248.0/255.0, blue: 255.0/255.0, alpha: 1.0)
      }
      }


      And we have an apply method that applies the Theme to all of the views we use in our app:



      func apply(){
      defaults.set(rawValue, forKey: "selectedTheme")

      UIApplication.shared.delegate?.window??.tintColor = tintColor

      let navBarAppearance = UINavigationBar.appearance()
      navBarAppearance.barStyle = barStyle
      navBarAppearance.backgroundColor = backgroundColor
      navBarAppearance.barTintColor = backgroundColor
      navBarAppearance.tintColor = tintColor
      navBarAppearance.isTranslucent = false
      navBarAppearance.titleTextAttributes = [NSAttributedString.Key.foregroundColor: textColor]
      let tabBarAppearance = UITabBar.appearance()
      tabBarAppearance.barStyle = barStyle
      tabBarAppearance.backgroundColor = backgroundColor
      tabBarAppearance.barTintColor = backgroundColor

      let toolBar = UIToolbar.appearance()
      toolBar.backgroundColor = backgroundColor
      toolBar.tintColor = backgroundColor
      toolBar.barStyle = barStyle
      toolBar.isTranslucent = false
      toolBar.barTintColor = backgroundColor

      UITableViewCell.appearance().backgroundColor = backgroundColor
      UILabel.appearance(whenContainedInInstancesOf: [UITableViewCell.self]).textColor = textColor
      UILabel.appearance().textColor = textColor

      UITextField.appearance().keyboardAppearance = keyboardColor
      UITextField.appearance().textColor = textColor
      UITextField.appearance().backgroundColor = backgroundColor

      UITextView.appearance().textColor = textColor
      UITextView.appearance().backgroundColor = backgroundColor

      MultiSelectSegmentedControl.appearance().tintColor = tintColor
      MultiSelectSegmentedControl.appearance().backgroundColor = backgroundColor

      UISegmentedControl.appearance().tintColor = tintColor
      UISegmentedControl.appearance().backgroundColor = backgroundColor

      UIButton.appearance().tintColor = tintColor

      BigButton.appearance().backgroundColor = Theme.current.tintColor
      BigButton.appearance().tintColor = Theme.current.backgroundColor

      UIPickerView.appearance().backgroundColor = Theme.current.backgroundColor
      UIPickerView.appearance().tintColor = Theme.current.tintColor

      UITableView.appearance().backgroundColor = backgroundColor
      UITableView.appearance().separatorColor = cellSelectionColor

      UISearchBar.appearance().backgroundColor = backgroundColor
      UISearchBar.appearance().barTintColor = tintColor
      UISearchBar.appearance().searchBarStyle = .minimal
      UITextView.appearance().backgroundColor = backgroundColor
      UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).textColor = textColor

      UISwitch.appearance().onTintColor = tintColor

      let colorView = UIView()
      colorView.backgroundColor = cellSelectionColor

      UITableViewCell.appearance().selectedBackgroundView = colorView
      }


      When one selects text in our app and presses the "look up" button in the popup menu item, the popup that appears looks right. However, when you click on some of the views (such as dictionary and siri knowledge), the background or text colors appear to have been changed. Example:



      Darkened Text



      How can we control the text color on this popup?



      EDIT: The goal is to find the name of the UI Object that is created when the UIMenuItems are pressed. It’s not in the XCode Debugger Inspector, nor is it in self.view.subviews. It seems to be some kind of built-in object that is hidden from the rest of the processes.







      ios swift user-interface themes






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 at 3:08

























      asked Nov 11 at 17:20









      rassar

      2,2081928




      2,2081928
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted
          +200










          There could be one or two possible issues



          1)
          You need to make sure that you are not setting textColor for labels and backgroundColor for the view explicitly in the code. Label's color should be kept default so that it can use the appearance color. For example, lets say we have set the textColor as default as shown in the below image,



          enter image description here



          Now if we apply the textColor appearance on UILabel by doing UILabel.appearance().textColor = .green. It will change the color to green once you will open the popup.



          But if you are setting the textColor explicitly after setting the appearance as below,



          UILabel.appearance().textColor = .green
          copyrightLabel.textColor = .yellow


          then it will discard the appearance setting and set the color(i.e, .yellow) you provided later.



          2)
          The other possible issue could be the creation of this popup before changing the appearance. What i mean is if you have instantiated this popup at the time when appearance was light so if you change the appearance now to dark, it will not update the popup colors automatically to dark because it's already created. If this is the case then you might have to do reloadData on tableView/collectionView and update all other view colors yourself.






          share|improve this answer



















          • 1




            Sorry for the late reply -- thank you so much, this worked great!
            – rassar
            Nov 19 at 2:49










          • @rassar Glad it helped!
            – Kamran
            Nov 19 at 5:44











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251249%2fwhat-uikit-object-controls-look-up-popup-appearance%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted
          +200










          There could be one or two possible issues



          1)
          You need to make sure that you are not setting textColor for labels and backgroundColor for the view explicitly in the code. Label's color should be kept default so that it can use the appearance color. For example, lets say we have set the textColor as default as shown in the below image,



          enter image description here



          Now if we apply the textColor appearance on UILabel by doing UILabel.appearance().textColor = .green. It will change the color to green once you will open the popup.



          But if you are setting the textColor explicitly after setting the appearance as below,



          UILabel.appearance().textColor = .green
          copyrightLabel.textColor = .yellow


          then it will discard the appearance setting and set the color(i.e, .yellow) you provided later.



          2)
          The other possible issue could be the creation of this popup before changing the appearance. What i mean is if you have instantiated this popup at the time when appearance was light so if you change the appearance now to dark, it will not update the popup colors automatically to dark because it's already created. If this is the case then you might have to do reloadData on tableView/collectionView and update all other view colors yourself.






          share|improve this answer



















          • 1




            Sorry for the late reply -- thank you so much, this worked great!
            – rassar
            Nov 19 at 2:49










          • @rassar Glad it helped!
            – Kamran
            Nov 19 at 5:44















          up vote
          1
          down vote



          accepted
          +200










          There could be one or two possible issues



          1)
          You need to make sure that you are not setting textColor for labels and backgroundColor for the view explicitly in the code. Label's color should be kept default so that it can use the appearance color. For example, lets say we have set the textColor as default as shown in the below image,



          enter image description here



          Now if we apply the textColor appearance on UILabel by doing UILabel.appearance().textColor = .green. It will change the color to green once you will open the popup.



          But if you are setting the textColor explicitly after setting the appearance as below,



          UILabel.appearance().textColor = .green
          copyrightLabel.textColor = .yellow


          then it will discard the appearance setting and set the color(i.e, .yellow) you provided later.



          2)
          The other possible issue could be the creation of this popup before changing the appearance. What i mean is if you have instantiated this popup at the time when appearance was light so if you change the appearance now to dark, it will not update the popup colors automatically to dark because it's already created. If this is the case then you might have to do reloadData on tableView/collectionView and update all other view colors yourself.






          share|improve this answer



















          • 1




            Sorry for the late reply -- thank you so much, this worked great!
            – rassar
            Nov 19 at 2:49










          • @rassar Glad it helped!
            – Kamran
            Nov 19 at 5:44













          up vote
          1
          down vote



          accepted
          +200







          up vote
          1
          down vote



          accepted
          +200




          +200




          There could be one or two possible issues



          1)
          You need to make sure that you are not setting textColor for labels and backgroundColor for the view explicitly in the code. Label's color should be kept default so that it can use the appearance color. For example, lets say we have set the textColor as default as shown in the below image,



          enter image description here



          Now if we apply the textColor appearance on UILabel by doing UILabel.appearance().textColor = .green. It will change the color to green once you will open the popup.



          But if you are setting the textColor explicitly after setting the appearance as below,



          UILabel.appearance().textColor = .green
          copyrightLabel.textColor = .yellow


          then it will discard the appearance setting and set the color(i.e, .yellow) you provided later.



          2)
          The other possible issue could be the creation of this popup before changing the appearance. What i mean is if you have instantiated this popup at the time when appearance was light so if you change the appearance now to dark, it will not update the popup colors automatically to dark because it's already created. If this is the case then you might have to do reloadData on tableView/collectionView and update all other view colors yourself.






          share|improve this answer














          There could be one or two possible issues



          1)
          You need to make sure that you are not setting textColor for labels and backgroundColor for the view explicitly in the code. Label's color should be kept default so that it can use the appearance color. For example, lets say we have set the textColor as default as shown in the below image,



          enter image description here



          Now if we apply the textColor appearance on UILabel by doing UILabel.appearance().textColor = .green. It will change the color to green once you will open the popup.



          But if you are setting the textColor explicitly after setting the appearance as below,



          UILabel.appearance().textColor = .green
          copyrightLabel.textColor = .yellow


          then it will discard the appearance setting and set the color(i.e, .yellow) you provided later.



          2)
          The other possible issue could be the creation of this popup before changing the appearance. What i mean is if you have instantiated this popup at the time when appearance was light so if you change the appearance now to dark, it will not update the popup colors automatically to dark because it's already created. If this is the case then you might have to do reloadData on tableView/collectionView and update all other view colors yourself.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 at 3:51

























          answered Nov 14 at 12:29









          Kamran

          4,86711027




          4,86711027








          • 1




            Sorry for the late reply -- thank you so much, this worked great!
            – rassar
            Nov 19 at 2:49










          • @rassar Glad it helped!
            – Kamran
            Nov 19 at 5:44














          • 1




            Sorry for the late reply -- thank you so much, this worked great!
            – rassar
            Nov 19 at 2:49










          • @rassar Glad it helped!
            – Kamran
            Nov 19 at 5:44








          1




          1




          Sorry for the late reply -- thank you so much, this worked great!
          – rassar
          Nov 19 at 2:49




          Sorry for the late reply -- thank you so much, this worked great!
          – rassar
          Nov 19 at 2:49












          @rassar Glad it helped!
          – Kamran
          Nov 19 at 5:44




          @rassar Glad it helped!
          – Kamran
          Nov 19 at 5:44


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251249%2fwhat-uikit-object-controls-look-up-popup-appearance%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?