def step__confirmation(**kargs):
     if not is_yes(
             input("Are you sure you want to reset the canvas? [y/N]: ")):
         print("Come back when you are.")
         goodbye()
     if not is_yes(
             input(
                 "Are you really sure? Pixel data will be erased from the database and pixel counts will reset back to zero [y/N]: "
             )):
         print(
             "Take your time, think it through, and come back when you are."
         )
         goodbye()
    def step__update_palette(**kargs):
        config, config_path = itemgetter('config', 'config_path')(kargs)

        if not is_yes(input('Update palette colors? [y/N]: ')):
            return

        color_regex = re.compile(r'^#[a-f0-9]{6}$', re.IGNORECASE)

        palette = config.get('board.palette')
        new_palette = None
        while new_palette is None:
            try:
                new_palette = json_loads(input('Paste Palette array: '))

                if type(new_palette) != list or any(
                        type(v) != str or not color_regex.match(v)
                        for v in new_palette):
                    new_palette = None
                    raise Exception('Invalid array format')

                palette = new_palette
            except:
                print(
                    'Invalid array format. Array must be in the format: \'["#000000", "#FF0000", ...]\''
                )

        replace_hocon_value(config_path, 'board.palette', new_palette)
        print('Palette updated')

        if not is_yes(input('Update default color index? [y/N]: ')):
            return

        new_default_color = None
        while new_default_color is None:
            try:
                new_default_color = int(input('New default color index: '))

                if new_default_color < 0 or new_default_color >= len(palette):
                    new_default_color = None
                    print('Default color index out of range')
            except ValueError:
                print('New default color index is not an integer')

        replace_hocon_value(config_path, 'board.defaultColor',
                            new_default_color)
        print('Default color index updated')
 def step__shutdown_server(**kargs):
     if not is_yes(input("Is Pxls turned off? [y/N]: ")):
         print("Turn off Pxls to continue.")
         goodbye()