wp_kses_post removes inline style

Hi Guys,

We’re adding an inline style inside the loop to color every post item in the blog with a user defined colors, Is there anyway to use wp_add_inline_style instead? as well as we do so in widgets to add a background image for About widget and we need background-size to be cover.

Everything working properly but when using wp_kses_post it removes both [style tag] and [style attribute inside an HTML element] from both post items and widgets, Actually we cannot use wp_add_inline_style for the dynamic user-defined colors and images.