added inverse function and maincolor for background