Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanCarloMachado committed Jun 9, 2024
1 parent f8a9441 commit d7f3b6e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions python_search/theme.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import datetime

class TimeBasedThemeSelector:

class ThemeSelector:
HOUR_FROM = 8
HOUR_TO = 17

def get_theme(self) -> str:

"""
Returns the theme to use based on the current time
"""
import os ; home = os.environ['HOME']
if os.path.exists(home + '/.python_search/theme'):
theme = open(home + '/.python_search/theme').read().strip()
if theme == 'Desert':
return DesertTheme()



now = datetime.datetime.now()
if now.hour >= self.HOUR_FROM and now.hour <= self.HOUR_TO:
return NewLight()
Expand Down Expand Up @@ -83,4 +93,4 @@ def __init__(self):


def get_current_theme():
return TimeBasedThemeSelector().get_theme()
return ThemeSelector().get_theme()

0 comments on commit d7f3b6e

Please sign in to comment.