Hydrogen shows promise as a replacement for conventional fossil fuels. However, its high flammability and gas permeability pose high demands on sensors, which must respond quickly and accurately. Nanoscaling improves the kinetics and allows for optical hydrogen sensing. A nanoscaled metallic sensor typically shows a welldefined extinction peak in the optical regime and one proposed sensing technique is to detect the shift in said peak due to hydrogenation. The aim of this thesis is to, from first-principles, study the optical response of PdAu nanodisks as a function of hydrogenation. PdAu:H was mainly treated as a random alloy but thermodynamic structures were also investigated. Cluster expansions were used in combination with Monte Carlo simulations to generate thermodynamically representative PdAu:H structures. The dielectric functions for the random and the thermodynamic structures were calculated by applying static and time-dependent density functional theory. Optical extinction spectra of PdAu:H nanodisks were obtained via electromagnetic finite-difference time-domain simulations using the previously calculated dielectric functions. The extinction peak of nanodisks with a diameter of 100 nm and height 20 nm showed a redshift due to hydrogenation over the entire range of gold concentrations of 0 to 42% considered here, and the redshift is approximately linear with respect to hydrogen. Even though there is non-trivial ordering in the thermodynamic PdAu:H structures, no clear difference between the random and thermodynamic case was observed in the optical response.