# Color Simulation of Multilayered Thin Films Using Python
## 1 Introduction  
The color of an object is one of the first characteristics that captures our attention. In the 17 th and 18 th centuries--the Age of Enlightenment--vigorous efforts were made to understand natural phenomena, and the study of light and color was systematized by luminaries such as [PERSON] and [PERSON]. With the advancement of computational techniques and theoretical frameworks, the simulation of color based on electrodynamics and optics has become an effective tool for predicting and elucidating experimental results in condensed matter physics and materials science [1, 2, 3]. As thin-film interference and multilayer coatings have recently garnered significant attention due to their ability to manipulate light at the nanoscale, color simulation techniques have been employed increasingly frequently. These techniques aim to describe or predict colors based on various factors, such as surface oxidation [4], crystallinity [5], and composition [6]. They have also been applied to explain the color variations generated in Mie resonators based on liquid crystals [7].  
Despite the availability of commercial software and web-based tools used for optical simulations [8, 9, 10], access to internal processes is often restricted due to proprietary algorithms, limiting customization. Nevertheless, researchers and engineers frequently look for flexible and customizable tools to adjust their simulations to meet specific experimental conditions and material properties.  
Recently, many individuals have used programming languages to carry out their own tasks, such as data analysis [11, 12], fitting [13, 14], and simulation [15, 16]. Among the different programming languages, Python stands out because of its open-source license, user-friendly interface, and various libraries which include functions essential for simulation, including calculation, visualization, and interpolation [17, 18, 19]. In addition to these features, advanced algorithms such as machine learning algorithms have been developedand utilized [20; 21; 22]. Consequently, there is a growing demand for fundamental theoretical simulations that can complement and work with modern programming languages and algorithmic approaches.  
Here, we introduce a Python-based approach for simulating the color of thin-film multilayers, while providing ample background on its underlying physics and coding--from basic electrodynamics, including the Fresnel equations, to the conversion of reflectance spectrum to RGB values based on a color matching function. Our code requires only information on the complex refractive indices (within the visible range) and thickness of each layer and a specific incident angle. To validate this code, we compare the simulated colors of several thin films with other results: SiO\({}_{2}\) films from the existing literature and SnO\({}_{2}\) and ZnO thin films with a thickness gradient, which were prepared for this study. The code is straightforward and allows individuals with basic Python knowledge to easily modify or add conditions, facilitating color simulation under various conditions and for integration with other applications. We hope that this code helps students and researchers working on materials science and AI-based research in various ways.