Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Change Link colors in QT Assistant with a Dark Stylesheet
Forum Update on Monday, May 27th 2025

Change Link colors in QT Assistant with a Dark Stylesheet

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manojbaishya
    wrote on last edited by
    #1

    Hi all, I am using this dark theme to make reading Qt documentation more comfortable.

    assistant -stylesheet darcula.css
    

    However, the link colors are green and cannot be modified, making them unreadable.

    link-text.png

    I have read this question: How can I change the "link" colors in Qt Assistant?, but there is no solution.

    How do I change the link colors?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      That's actually html/css, I don't think it can be changed by qss.
      You may need to modify the source css file and rebuild the doc files if you want to change that.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        manojbaishya
        wrote on last edited by manojbaishya
        #3

        Thank you.

        That sounds daunting. I will give it a shot if you can give me some pointers and not too much work is needed. A white background is straining for long reading times.

        This is my Qt install directory tree - pastebin.com/Kbka6hUv.

        There is a "Docs" folder in install root and "Src" inside "5.15.0". Where can I modify this CSS file and how to rebuild?

        Noticed <root>/Docs/Qt-5.15.0/<some-folder>/style/offline.css file but changing "a:link" property has no effect.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on last edited by Bonnie
          #4

          You can check The Qt Help Framework in the Assistant.
          What imported in the Assistant are .qch files which means Qt Compressed Help files.
          So after your modify the css files (maybe better to modify both offline.css and offline-simple.css) in a module folder, call

          qhelpgenerator module-name/module-name.qhp -o module-name.qch

          to build a new .qch file.
          To show the content of the new file (even if you overwrite the old file with it) you may need to go to Edit > Preferences > Documentation, remove the old ones and add the new ones.

          1 Reply Last reply
          1
          • M Offline
            M Offline
            manojbaishya
            wrote on last edited by
            #5

            Thanks for the instructions. I fixed all the link colours!

            qt-assistant-help-fixed.png

            For the people coming from search engines in future, here is the solution:

            1. Open a random module's style folder, for example, "<install-dir>/Docs/Qt-5.15.0/qtcore/style".
            2. Copy the two offline.css and offline-simple.css files to a temporary folder, say, ~/Documents/tmp/css/
            3. Change working directory to ~/Documents/tmp
            4. In css/offline.css file, change the color property of a:link, a:hover, a:visited, a:visited:hover selectors.
            5. Similarly, in css/offline-simple.css file, edit the pre a[href], a[href] and a[href|="http://"], a[href|="https://"].
            6. In ~/Documents/tmp, create two files: copy_styles.py and run_qhelp.py.
            7. Paste the following code to copy_styles.py. Do the necessary changes in the variable as commented:
            import os
            import shutil
            
            # Change the following path according to your system and uncomment
            
            # docroot = "<install-dir>/Docs/Qt-5.15.0"
            
            # Verify all code before running!
            
            offline_simple_file = os.path.join(os.getcwd(), "css/offline-simple.css")
            offline_file = os.path.join(os.getcwd(), "css/offline.css")
            
            module_docs = os.listdir(docroot)
            for item in module_docs:
                itempath = os.path.join(docroot, item)
                if not os.path.isfile(itempath):
                    style_folder = os.path.join(itempath, "style")
                    if os.path.exists(style_folder):
                        shutil.copy(offline_simple_file, style_folder)
                        shutil.copy(offline_file, style_folder)
            
            
            1. Paste the following code to run_qhelp.py. Again, do the necessary changes in the variable as commented:
            import os
            import subprocess
            
            # Change the following paths according to your system and uncomment
            
            # qhelpgenerator = "<install-dir>/<version-number>/gcc_64/bin/qhelpgenerator"
            # docroot = "<install-dir>/Docs/Qt-5.15.0"
            
            
            # Since the following code is running a process, it is even more important to verify all of it (check for paths, etc.). I am not responsible for any deleted files or damage to your system. Use at your own risk!
            
            list_dir = os.listdir(docroot)
            for item in list_dir:
                itempath = os.path.join(docroot, item)
                if not os.path.isfile(itempath):
                    module = itempath
                    help_project_file = os.path.join(module, item + ".qhp")
                    if os.path.exists(help_project_file):
                        outputfile = module + ".qch"
                        subprocess.run([qhelpgenerator, help_project_file, "-o", outputfile])
            
            
            1. In a shell, cd to ~/Documents/tmp.
            2. First run: python copy_styles.py.
            3. Then run: run_qhelp.py.

            Depending on your system, you may need to add the new help files in Qt Assistant in Edit > Preferences > Documentation, but I did not have to (they updated automatically)

            1 Reply Last reply
            0
            • D Offline
              D Offline
              Dariusz
              wrote on last edited by Dariusz
              #6

              Is this assistant the same as C:\Qt\6.3.1\msvc2019_64\bin\assistant.exe ?
              I wan't dark theme too ;c

              Ok it is, epic ! But I get this >
              Any idea how to style the... white BG parts / black text?
              8677ee36-0109-498c-932f-a9d938d1abd6-image.png

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                Zoms
                wrote on last edited by
                #7

                How to change the interface style of my Qt Assistant to the style of the help document in Qt Creator

                image.png

                image.png

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved