old_contents: #!/usr/bin/env python3
  
  from config import colors, icons
  
  # TODO properties instead of GETs/SETs
  
  class Widget:
      '''
      Abstrac class for all lemonbar widgets.
      '''
  
      def __init__(self, name):
          '''
          Params:
              bg: background color
              fg: foreground color
              icon: icon
              icon_p: position of the icon. 0 to the left of the text, 1 to the
              right of the text.
          '''
          # Temp
          self.name = name
  
          self.bg = colors['c_background']
          self.fg = colors['c_white']
          self.icon = icons['laptop']
          self.icon_p = 0
  
          self.colors_rules = dict()
  
      def update(self):
          '''
          Update widget status.
          '''
          pass
  
      def action(self):
          '''
          Implement if widget should execute any aciont, commands, programs...
          '''
          pass
  
      def get_output(self):
          '''
          Returns generated string for lemonbar.
          '''
          return ' {} '.format(self.name)
  
new_contents: #!/usr/bin/env python3
  
  from config import colors, icons
  
  # TODO properties instead of GETs/SETs
  
  class Widget:
      '''
      Abstrac class for all lemonbar widgets.
      '''
  
      def __init__(self, name):
          '''
          Params:
              bg: background color
              fg: foreground color
              icon: icon
              icon_p: position of the icon. 0 to the left of the text, 1 to the
              right of the text.
          '''
          # Temp
          self.name = name
  
          self.bg = colors['c_background']
          self.fg = colors['c_white']
          self.icon = icons['laptop']
          self.icon_p = 0
  
          self.colors_rules = dict()
  
      def update(self):
          '''
          Update widget status.
          '''
          pass
  
      def action(self):
          '''
          Implement if widget should execute any aciont, commands, programs...
          '''
  
      def set_action(self, string)
          return '%{{A{1}:{2}:}}{0}%{{A}}'.format(string, button, action)
  
      def set_bg(self, string):
          return '%{{B{1}}}{0}%{{B{1}}}'.format(string, self.bg)
  
      def set_fg(self, string):
          return '%{{F{1}}}{0}%{{F{1}}}'.format(string, self.fg)
  
      def get_output(self):
          '''
          Returns generated string for lemonbar.
          '''
          return self.set_fg(' {} '.format(self.name))
  
  if __name__ == '__main__':
      a = Widget('a')
  
      print(a.get_output())
  
subject: Add bg and fg function.