Repository: inventree/InvenTree

Issue:
[FR] Color theme selection should be under "Display Settings"
Currently under "Account Settings"

![image](https://user-images.githubusercontent.com/4020546/141304199-0e0a5d27-3f77-45be-a832-4792e98e3098.png)

One would expect it under "Display Settings"

![image](https://user-images.githubusercontent.com/4020546/141304254-7f9f125a-f24f-48b5-8752-e746338da2ad.png)


[BUG] Color theme selection not sticky
<!---
Everything inside these brackets is hidden - please remove them where you fill out information.
--->


**Describe the bug**
Color theme selection box shows "Default" as color theme when other color theme is selected.

**Steps to Reproduce**

Steps to reproduce the behavior:
- Go to Settings > Account Settings
- Under Theme settings, select "Dark Reader"
- Click "Set Theme"
- Color theme is updated but "Default" is show in the theme box

**Expected behavior**
The selected color theme name should be displayed, not default.

**Screenshots**
![image](https://user-images.githubusercontent.com/4020546/141303794-67f4bd90-88f2-42da-a294-7063aa18273c.png)

**Deployment Method**
- [ ] Docker
- [X] Bare Metal

**Version Information**
InvenTree-Version: 0.6.0 dev
Django Version: 3.2.5
Commit Hash: a81070833
Commit Date: 2021-11-11
Database: sqlite3
Debug-Mode: True
Deployed using Docker: False


Discussion:

Resolving patch:
diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py
--- a/InvenTree/common/models.py
+++ b/InvenTree/common/models.py
@@ -1269,9 +1269,6 @@ def get_price(instance, quantity, moq=True, multiples=True, currency=None, break
 
 class ColorTheme(models.Model):
     """ Color Theme Setting """
-
-    default_color_theme = ('', _('Default'))
-
     name = models.CharField(max_length=20,
                             default='',
                             blank=True)
@@ -1291,10 +1288,7 @@ def get_color_themes_choices(cls):
         # Get color themes choices (CSS sheets)
         choices = [(file_name.lower(), _(file_name.replace('-', ' ').title()))
                    for file_name, file_ext in files_list
-                   if file_ext == '.css' and file_name.lower() != 'default']
-
-        # Add default option as empty option
-        choices.insert(0, cls.default_color_theme)
+                   if file_ext == '.css']
 
         return choices
 
diff --git a/InvenTree/part/templatetags/inventree_extras.py b/InvenTree/part/templatetags/inventree_extras.py
--- a/InvenTree/part/templatetags/inventree_extras.py
+++ b/InvenTree/part/templatetags/inventree_extras.py
@@ -292,6 +292,19 @@ def progress_bar(val, max, *args, **kwargs):
 
 @register.simple_tag()
 def get_color_theme_css(username):
+    user_theme_name = get_user_color_theme(username)
+    # Build path to CSS sheet
+    inventree_css_sheet = os.path.join('css', 'color-themes', user_theme_name + '.css')
+
+    # Build static URL
+    inventree_css_static_url = os.path.join(settings.STATIC_URL, inventree_css_sheet)
+
+    return inventree_css_static_url
+
+
+@register.simple_tag()
+def get_user_color_theme(username):
+    """ Get current user color theme """
     try:
         user_theme = ColorTheme.objects.filter(user=username).get()
         user_theme_name = user_theme.name
@@ -300,13 +313,7 @@ def get_color_theme_css(username):
     except ColorTheme.DoesNotExist:
         user_theme_name = 'default'
 
-    # Build path to CSS sheet
-    inventree_css_sheet = os.path.join('css', 'color-themes', user_theme_name + '.css')
-
-    # Build static URL
-    inventree_css_static_url = os.path.join(settings.STATIC_URL, inventree_css_sheet)
-
-    return inventree_css_static_url
+    return user_theme_name
 
 
 @register.simple_tag()


Test patch: